Originally Posted by
abdo meghari
In fact,
I would like you to filter the data that appears in the list box based on the text box.
Yes I understand what you mean.
Maybe I can still do it, but I'm too lazy to think on how to do it .
Why lazy, because it will involve filtering the sheet each time you type a letter in the TextBox1.
For example : you type "B",
then it will filter the sheet to only the rows which contains letter B.
Then the code need to clear the ListBox then put the filtered result back to the ListBox.
Then after you type B, you type S.
Then the code will filter the sheet to only the rows which contains letter BS
Then the code need to clear the ListBox then put the filtered result back to the ListBox
and so on until the last thing you type is 1, which makes BSJ100-TR1 as a whole
Then the code will filter the sheet to only the rows which contains BSJ100-TR1
Then the code need to clear the ListBox then put the filtered result back to the ListBox.
The code I use is not filtering the sheet,
but removing the existing item in the ListBox.
It removes all the rows of the third column of the ListBox if it doesn't have the text you type in the ListBox.
Not sure, but I think the removing way is faster then the filtering the sheet way.
Anyway, just change the whole sub TextBox1_AfterUpdate to this :
(please remember that you need to type the whole text)
Let's hope some of the experts here see what you want,
and willing to help to get what you want
because I myself is curious if there is a nice way
to get what you want without filtering the sheet each time you type
Curious, I change the column D data to various text and have the removing item listbox way to get what you want :
2021-09-21_18-28-16.gif
As you can see from the animation above, we face the same problem
after you type pali1, then the listbox show you pali1 and pali12.
Just want to give you some idea...
why don't you try about clicking the ListBox ?
I mean, after the last result in the ListBox showing pali1 and pali2,
so if you click pali1, it will remove pali2.
With an option to click the item in the ListBox, you have the chance to not need to type in the TextBox if you want to see an individual result of column D....
just click the item in the listbox, then the listbox display only the clicked item - removing the rest of the items.
Bookmarks