I have some code in my project that searches a worksheet and displays the matches in a textbox but i cannot understand what it is looking at so that i can amend it to look elsewhere, the code looks like this:
it works well and produces a list showing the contents of Column 1, Column 2, Column 3, Column 4, Column 5, Colum 6, Column 7
This is all good but i actually want to see the contents of different columns so i have tried changing the code for example to see column 20 i tried:
but this failed nothing changed
I also tried :
this also failed but with an error
what am i missing here, i thought i t was offsets from from rngFind as the code says therefore not column a,b,c,d etc ?
this is really puzzling me, what i'm asking for is a break down of what this line of code is saying (in english !)
Code:
'add the values to the listbox
Do
If rngFind.Row > 1 Then
lstLookup.AddItem rngFind.Value
lstLookup.List(lstLookup.ListCount - 1, 1) = rngFind.Offset(0, 1)
lstLookup.List(lstLookup.ListCount - 1, 2) = rngFind.Offset(0, 2)
lstLookup.List(lstLookup.ListCount - 1, 3) = rngFind.Offset(0, 3)
lstLookup.List(lstLookup.ListCount - 1, 4) = rngFind.Offset(0, 4)
lstLookup.List(lstLookup.ListCount - 1, 5) = rngFind.Offset(0, 5)
lstLookup.List(lstLookup.ListCount - 1, 6) = rngFind.Offset(0, 6)
lstLookup.List(lstLookup.ListCount - 1, 7) = rngFind.Offset(0, 7)
End If
'find the next address to add
Set rngFind = .FindNext(rngFind)
Loop While Not rngFind Is Nothing And rngFind.Address <> strFirstFind
End If
it works well and produces a list showing the contents of Column 1, Column 2, Column 3, Column 4, Column 5, Colum 6, Column 7
This is all good but i actually want to see the contents of different columns so i have tried changing the code for example to see column 20 i tried:
Code:
lstLookup.List(lstLookup.ListCount - 1, 7) = rngFind.Offset(0, 20)
I also tried :
Code:
lstLookup.List(lstLookup.ListCount - 1, 20) = rngFind.Offset(0, 7)
what am i missing here, i thought i t was offsets from from rngFind as the code says therefore not column a,b,c,d etc ?
this is really puzzling me, what i'm asking for is a break down of what this line of code is saying (in english !)
Code:
lstLookup.List(lstLookup.ListCount - 1, 7) = rngFind.Offset(0, 7)