torquil
02-12-2020, 08:56 AM
Hello Everyone, I am disapearing down a frustrating black hole here.
I have a working bit of VBA that populates a List box from a range, but i cannot get the range to be hard set to the specific sheet.
If i load the userform on any other sheet, it tries to using data on that sheet to populate the listbox and not the orginal source I want:
Private Sub tbSymbol_Change()
' Searchable List box for Symbol
Dim i As Integer
lbSymbol.Clear
lbSymbol.Visible = True
For i = 2 To Worksheets("Nasdaq live").Range("A1000").End(xlUp).Row
If UCase(Left(Cells(i, 1), Len(tbSymbol.Text))) = UCase(tbSymbol.Text) Then
lbSymbol.AddItem Cells(i, 1)
End If
Next i
End Sub
Can anyone see where i have gone wrong?
the code acts the same with or without Worksheets("Nasdaq live").
I have a working bit of VBA that populates a List box from a range, but i cannot get the range to be hard set to the specific sheet.
If i load the userform on any other sheet, it tries to using data on that sheet to populate the listbox and not the orginal source I want:
Private Sub tbSymbol_Change()
' Searchable List box for Symbol
Dim i As Integer
lbSymbol.Clear
lbSymbol.Visible = True
For i = 2 To Worksheets("Nasdaq live").Range("A1000").End(xlUp).Row
If UCase(Left(Cells(i, 1), Len(tbSymbol.Text))) = UCase(tbSymbol.Text) Then
lbSymbol.AddItem Cells(i, 1)
End If
Next i
End Sub
Can anyone see where i have gone wrong?
the code acts the same with or without Worksheets("Nasdaq live").