code filters the list boxes based on what is written in any text box and ignore the empty text box.

saftawy1

Board Regular
Joined
Oct 12, 2021
Messages
65
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
can you help me in that?
This code filters the list boxes based on what is written in one text box. The code needs to be modified to filter based on what is written in any text box and ignore the empty text box.

Dim i As Integer
Dim ListCount1 As Integer
ListCount1 = ListBox1.ListCount - 1
If TextBox8.Value <> "" Or TextBox9.Value <> "" Or TextBox10.Value <> "" Or TextBox11.Value <> "" Or TextBox12.Value <> "" Or TextBox13.Value <> "" Then
For i = ListCount1 To 0 Step -1
If InStr(1, ListBox1.List(i, 5), TextBox8) = 0 Or InStr(1, ListBox1.List(i, 5), TextBox9) = 0 Or InStr(1, ListBox1.List(i, 5), TextBox10) = 0 Or InStr(1, ListBox1.List(i, 5), TextBox11) = 0 Or InStr(1, ListBox1.List(i, 5), TextBox12) = 0 Or InStr(1, ListBox1.List(i, 5), TextBox13) = 0 Then
ListBox1.RemoveItem (i)

thanks for your interesting
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: filters the list boxes based on what is written in any text box and ignore the empty text
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: filters the list boxes based on what is written in any text box and ignore the empty text
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
i am sorry for that
 
Upvote 0

Forum statistics

Threads
1,214,780
Messages
6,121,522
Members
449,037
Latest member
tmmotairi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top