I have a ListBox that I am reading a text file into that has several lines. I am currently clicking a line to search for the value clicked in a sheet and then adding that value to the listbox which goes to the bottom.
If I have 10 lines in my listbox and I click line 5, how do I add an item to line 6?
Sub FindListValue()
Dim FirstAddress As String
Dim rSearch As Range 'range to search
Dim c As Range
Sheets("PN-BINS").Activate
Set rSearch = ActiveSheet.Range("b1", Range("b65536").End(xlUp))
strFind = Me.ListBox1.Value 'what to look for
With rSearch
Set c = .Find(strFind, LookIn:=xlValues, LookAt:=xlWhole)
If Not c Is Nothing Then 'found it
c.Select
'MsgBox strFind & c.Offset(0, -1).Value
Me.ListBox1.AddItem strFind & " " & c.Offset(0, -1).Value
Else: MsgBox strFind & " is not listed!" 'search failed
'Range("K1").Select
End If
End With
End Sub
