VBA to select record in listbox based on textbox value

LB79

Registered User.
Local time
Today, 11:15
Joined
Oct 26, 2007
Messages
505
Hello,
I've been reading up on selecting records in a list box using VBA but so far I can only find details of selecting a record based on counting how many there are.
Can anyone tell me how to select a record based on its value.
Eg I have txtbox1 which contains ‘=Format(Now(),”WW”) to give me the week number.
I want to look that week number up in LstBox1 and select it using VBA.
Thanks for any help.
 
How about this

Code:
Dim i As Integer
For i = 0 To Me.List0.ListCount - 1
If Me.List0.Column(1, i) = Me.Text2 Then
Me.List0.Selected(i) = True
End If
Next
 

Users who are viewing this thread

Back
Top Bottom