Blacksibe
12-17-2015, 03:10 AM
Hi, So this is all new to me. Started with VBA and learning as I go. Need some help on the following please. I am populating a combobox "Tech2" with a list of job numbers according to a name in the first combobox "Tech1". That all works fine. The problem starts when the job number has been used and are no longer available in "Tech2". I wrote an If function to change the listindex so that there are no blank spaces. I'm testing a few ideas but for some reason I get a invalid property value on this line of code "Me.Tech2.ListIndex = startnr"
"" Dim jobnr As String
Dim startnr As Integer
Dim endnr As Integer
'Tech2 combobox populates according to the name in Tech1 combobox where the name is a named range
jobnr = Tech1.Value
Sheets("Lists").Activate 'named range scope are sheets("Lists")'
Me.Tech2.RowSource = jobnr
endnr = 10000
If Me.Tech2 = "" Then
For startnr = 1 To endnr
Next startnr
End If
Me.Tech2.ListIndex = startnr ""
"" Dim jobnr As String
Dim startnr As Integer
Dim endnr As Integer
'Tech2 combobox populates according to the name in Tech1 combobox where the name is a named range
jobnr = Tech1.Value
Sheets("Lists").Activate 'named range scope are sheets("Lists")'
Me.Tech2.RowSource = jobnr
endnr = 10000
If Me.Tech2 = "" Then
For startnr = 1 To endnr
Next startnr
End If
Me.Tech2.ListIndex = startnr ""