listbox view

aloggies

New Member
Joined
Jun 21, 2022
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Please assist i want display all info in a row in the listbox currently its only showing the data in the first line i presume its something to do with the offset please help me

Private Sub TextBox207_Change()
Dim rFound As Range
Dim sFirstAddress As String
Dim LName As String

LName = TextBox207.Value

Me.ListBox1.Clear

With Worksheets("Sheet1").Range("a:ab")
Set rFound = .Find(what:=LName, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
If Not rFound Is Nothing Then
sFirstAddress = rFound.Address
Do
Me.ListBox1.AddItem rFound.Offset(1, 0).Value
Set rFound = .FindNext(rFound)
Loop While rFound.Address <> sFirstAddress
End If
End With




End Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi aloggies. It seems like this should work. HTH. Dave
Code:
Private Sub TextBox207_Change()
Dim Rng As Range, R As Range
Dim LName As String
Me.ListBox1.Clear

LName = TextBox207.Value
Set Rng = Worksheets("Sheet1").Range("a:ab")
For Each R In Rng
If LCase(R.Value) = LCase(LName) Then
Me.ListBox1.AddItem R.Value
Next R
End Sub
ps. Pleasse use code tags
 
Upvote 0

Forum statistics

Threads
1,223,879
Messages
6,175,148
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top