Display search result in ListBox from Multiple worksheet.

Today we will learn How to Display search result in ListBox from Multiple worksheet. First add all worksheet into ComboBox. Second : Design userform third : Double click on userform and write few vba code to additem into combobox for all worksheet 4th : write vba code to filter worksheet and then copy data and paste into SearchData sheet, Now write for listbox property and load the searched or filtered data in Listbox.

#How to sort ComboBox Alphabetically https://youtu.be/bJj6v3e2USo #Sort Data in ListBox https://youtu.be/dqelXeO4PhE #Remove Duplicate Item from ListBox https://youtu.be/BATTjsZ5BsI #Create pdf from ListBox https://youtu.be/GsJwsBDnzKs #Multi user login Module in Excel https://youtu.be/_VW0VAmQTKg #Display search result in Listbox with more than 10 Column https://youtu.be/i1k7Vz9Q-iU #Fully automatic Data Entry userform in Excel https://youtu.be/xVGEaMxviLI

VBA codes are given below....

Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim i As Long
Dim x As Long
Dim sh As Worksheet
Dim sht As Worksheet
Set sh = Worksheets(ComboBox1.Value)
Set sht = Worksheets("SearchData")
sht.Cells.Clear
i = sh.Range("B" & Rows.Count).End(xlUp).Row
sh.Range("A1:H1").AutoFilter Field:=2, Criteria1:="*" & Me.TextBox1.Value & "*"
sh.AutoFilter.Range.Copy sht.Range("A1")
Application.CutCopyMode = False
Me.ListBox1.ColumnCount = 8
Me.ListBox1.ColumnWidths = "30,150,60,40,40,40,60,40"
x = sht.Range("b" & Rows.Count).End(xlUp).Row
If x > 1 Then
Me.ListBox1.RowSource = "SearchData!A1:H" & x
MsgBox "Record Found"
Me.ListBox1.Selected(0) = True
Else
MsgBox "No Record Found"
End If
sh.AutoFilterMode = False
Application.ScreenUpdating = True
End Sub

Private Sub UserForm_Initialize()
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Name <> "SearchData" Then
Me.ComboBox1.AddItem ws.Name
End If
Next ws
End Sub

Click here to download this file

For Support & Feedback

Please comment, like & share

If you didn't subcribe my channel till now then Please subscribe

To Download this file please click the below download button & wait 10 sec, you will find download link

No comments:

Post a Comment