Hello, I'm in a last phase of making an userform with multicolumn list box where user can search value in entire database thru input box value and the found row value to be returned in list box, the found results may have multiples to be stored in arrays and return the same in listbox. Could any one help with solution. The Codes are:
Private Sub CommandButton2_Click()
' Clear Listbox of last search results
Me.ListBox1.Clear
Dim lb As MSForms.ListBox
Dim searchstring
Dim srchArray() As Variant
Dim lrw As Long, lcol As Long
Dim rngTarget As Range
searchstring = InputBox("Enter any of the following criteria to complete your search", "Search")
Set rngTarget = Worksheets("Dbase")..UsedRange
ReDim Preserve srchArray(1 To rngTarget.Rows.Count, 1 To rngTarget.Columns.Count)
With rngTarget
For lcol = 1 To .Columns.Count
For lrw = 1 To .Rows.Count
srchArray(lrw, lcol) = rngTarget.Cells(lrw, lcol)
Next lrw
Next lcol
End With
Set lb = Me.ListBox1
With lb
.ColumnCount = 6
.ColumnWidths = "100;100;30;300;30;80"
.List() = srchArray
End With
End Sub
Any help will highly appreciated....
Bookmarks