A
Alen32
I got this code her:
Private Sub UserForm1_Initialize()
Dim rFound As Range
Dim sFirstAdd As String
Dim rLook As Range
Dim rValue As Range
Set rValue = Ark1.Range("A5")
Set rLook = Ark11.Range("A10:A250")
Me.ListBox1.ColumnCount = 4
Set rFound = rLook.Find(rValue.Value, , , xlWhole)
If Not rFound Is Nothing Then
sFirstAdd = rFound.Address
Do
With Me.ListBox1
.AddItem rFound.Row
.List(.ListCount - 1, 1) = rFound.Value
.List(.ListCount - 1, 2) = rFound.Offset(0, 2).Value
.List(.ListCount - 1, 3) = rFound.Offset(0, 5).Value
End With
Set rFound = rLook.FindNext(rFound)
Loop Until rFound.Address = sFirstAdd
End If
End Sub
I have made command button on sheet1 which display userform with listbox,
but listbox is empty.
Private Sub UserForm1_Initialize()
Dim rFound As Range
Dim sFirstAdd As String
Dim rLook As Range
Dim rValue As Range
Set rValue = Ark1.Range("A5")
Set rLook = Ark11.Range("A10:A250")
Me.ListBox1.ColumnCount = 4
Set rFound = rLook.Find(rValue.Value, , , xlWhole)
If Not rFound Is Nothing Then
sFirstAdd = rFound.Address
Do
With Me.ListBox1
.AddItem rFound.Row
.List(.ListCount - 1, 1) = rFound.Value
.List(.ListCount - 1, 2) = rFound.Offset(0, 2).Value
.List(.ListCount - 1, 3) = rFound.Offset(0, 5).Value
End With
Set rFound = rLook.FindNext(rFound)
Loop Until rFound.Address = sFirstAdd
End If
End Sub
I have made command button on sheet1 which display userform with listbox,
but listbox is empty.