![]() |
filter listbox on Userform
Hi all ,
I would like to do the following : 1) Filter a listbox using a textbox , which means that if i put a string into the textbox i'd like to see only the filtered data in the listbox OR 2) Search data in the range of cells and select the corresponding row in the listbox. Is there a way to do this. I alredy searched the net but without results so , I'm open to all suggestions. Many Thanks MarMo |
filter listbox on Userform
Perhaps something like this:
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim rng as Range, cell as Range with worksheets("Sheet1") set rng = .Range(.Cells(2,1),.Cells(2,1).End(xldown)) End with Listbox1.Clear for each cell in rng if instr(1,cell,Textbox1.Value,vbTextcompare) then ListBox1.AddItem cell.Value end if Next End Sub -- Regards, Tom Ogilvy "MarMo" wrote in message ... Hi all , I would like to do the following : 1) Filter a listbox using a textbox , which means that if i put a string into the textbox i'd like to see only the filtered data in the listbox OR 2) Search data in the range of cells and select the corresponding row in the listbox. Is there a way to do this. I alredy searched the net but without results so , I'm open to all suggestions. Many Thanks MarMo |
filter listbox on Userform
Hello Tom ,
Thanks for responding . MarMo "Tom Ogilvy" wrote in message ... Perhaps something like this: Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim rng as Range, cell as Range with worksheets("Sheet1") set rng = .Range(.Cells(2,1),.Cells(2,1).End(xldown)) End with Listbox1.Clear for each cell in rng if instr(1,cell,Textbox1.Value,vbTextcompare) then ListBox1.AddItem cell.Value end if Next End Sub -- Regards, Tom Ogilvy "MarMo" wrote in message ... Hi all , I would like to do the following : 1) Filter a listbox using a textbox , which means that if i put a string into the textbox i'd like to see only the filtered data in the listbox OR 2) Search data in the range of cells and select the corresponding row in the listbox. Is there a way to do this. I alredy searched the net but without results so , I'm open to all suggestions. Many Thanks MarMo |
All times are GMT +1. The time now is 06:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com