I'm trying to get a combobox to retrieve a set of values based on it's current value using a pre-defined table. The code currently doesn't do anything, as I've run into the problem that hlookup is apparently not defined! What am I supposed to type in a macro to get it to do this?
The code I'm using is as follows:
Code:
Private Sub ComboBox1_Change()
Dim str As Integer
Dim dex As Integer
Dim con As Integer
Dim intel As Integer
Dim wis As Integer
Dim cha As Integer
ComboBox1.Clear
Dim racloc As String
racloc = Sheets("race").Range("B2")
For x = 2 To Sheets("race").Range("A1")
ComboBox1.AddItem racloc
racloc = Sheets("race").Range("B2").Offset(0, x - 1).Value
Next
With ComboBox1
str = HLookup(ComboBox1.Value, race, 2, False)
dex = HLookup(ComboBox1.Value, race, 3, False)
con = HLookup(ComboBox1.Value, race, 4, False)
intel = HLookup(ComboBox1.Value, race, 5, False)
wis = HLookup(ComboBox1.Value, race, 6, False)
cha = HLookup(ComboBox1.Value, race, 7, False)
End With
End Sub
I just ran it the one time to initialize it, so the values are in fact, there.. it keeps giving me the not defined error thereafter.