Excel VBA Course

(35% Sale Ends Jan. 26)

Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course (35% Discount)

Filter Data As you Type


Everything in worksheet is working based on your great video. I've encountered two issues. 

1. When clearing all filters, is there anyway to also clear what has been entered in all the active earch boxes?

2. Sometimes I will get a "Can't find project or library" error?





To your numbered points:

1. Given you have just 7 TextBoxes and one CommandButton (named "CLEAR") on your sheet (all ActiveX controls), you can use the following code which loops through the controls and -if they're called "TextBox" something- overwrites the value to "".

This also clears the Autofilter (so replaces your code). Note that the command to set the value (in bold below) is a bit different to how values are normally set:

Private Sub CLEAR_Click()

Dim ActX As OLEObject

'loop through ActiveX controls
For Each ActX In Sheet6.OLEObjects
    'Clear any called TextBox#
    If InStr(ActX.Name, "TextBox") > 0 Then ActX.Object.Text = ""
Next ActX

End Sub
That code is in the attached, revised file (where the filter in M is partially set- just click your Clear button to see it work!)

2. See Microsoft guidance on Can't find project or library



Did that work, Brad?
John_Ru (rep: 2857) Jan 17, '22 at 3:53 pm
John_Ru (rep: 2857) Jan 19, '22 at 4:40 pm
Brad. I will look at your question Find & Extract Text  later hopefully but did the above solution work? 
John_Ru (rep: 2857) Jan 27, '22 at 1:57 am
Add to Discussion

Answer the Question

You must create an account to use the forum. Create an Account or Login