currentdb
asked on
Filter data from an userform
Dear EE experts,
I'm trying to figure a way to filter data from an userform. I know that a filter can be added on any column, but what about doing this from an userform ?
Thanks for any help you can provide,
currentdb
I'm trying to figure a way to filter data from an userform. I know that a filter can be added on any column, but what about doing this from an userform ?
Thanks for any help you can provide,
currentdb
ASKER
Hi Sid,
I'm happy to see you around and yes I have a sample file.
If you go to ''Sheet 3'', I've already added a button ''Filter Acctopid''. This button opens the form ''UserForm 2''
Thanks
userform-sample-v7b.xlsm
I'm happy to see you around and yes I have a sample file.
If you go to ''Sheet 3'', I've already added a button ''Filter Acctopid''. This button opens the form ''UserForm 2''
Thanks
userform-sample-v7b.xlsm
Ok What col does Acctopid represent in sheet QUERY_FOR_GSL2?
Sid
Sid
ASKER
It's column O
Ok. On to it.
Sid
Sid
ASKER
If you need more explanations, let me know. Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oops, a small typo.
Just remove ".Range("$A$1:$BC$5")" from line 9
Sid
Just remove ".Range("$A$1:$BC$5")" from line 9
Sid
ASKER
Another small typo is on line 15 (msgbos Err.Description). Changed it to ''MsgBox :)
Thanks :)
Also one more thing.
In case you are unsure about the number of rows in Sheet "QUERY_FOR_GSL2" then use this code.
Sid
Also one more thing.
In case you are unsure about the number of rows in Sheet "QUERY_FOR_GSL2" then use this code.
Private Sub CommandButton1_Click()
Dim lastRow As Long
On Error GoTo Whoa
lastRow = Sheets("QUERY_FOR_GSL2").Range("A" & Rows.Count).End(xlUp).Row
If Len(Trim(TextBox1.Text)) = 0 Then
MsgBox "There is no value to filter"
Exit Sub
End If
With Sheets("QUERY_FOR_GSL2")
.Range("$A$1:$BC$" & lastRow).AutoFilter Field:=15, Criteria1:=TextBox1.Text
Unload Me
End With
Exit Sub
Whoa:
MsgBox Err.Description
End Sub
Sid
ASKER
Corrected it :)
If the number of rows change, I'll use the code you provided. For now, it's ok and I hope it will not go further more.
How I can add the other small part of code to go directly to sheet QUERY_FOR_GSL2 ? If I enter the Acctopid id number on Sheet 3, then click on the button, can it show the sheet QUERY_FOR_GSL2 without having to click on it ?
If the number of rows change, I'll use the code you provided. For now, it's ok and I hope it will not go further more.
How I can add the other small part of code to go directly to sheet QUERY_FOR_GSL2 ? If I enter the Acctopid id number on Sheet 3, then click on the button, can it show the sheet QUERY_FOR_GSL2 without having to click on it ?
Before this line
Exit Sub
Type this
Sheets("QUERY_FOR_GSL2").A ctivate
Sid
Exit Sub
Type this
Sheets("QUERY_FOR_GSL2").A
Sid
ASKER
It works perfectly! Thanks!
I'm going to open a new question on the same sample file I sumbitted earlier, but a little more complex.
Hold on as I open the question and post the link here, then close the actual question and award you full points.
I'm going to open a new question on the same sample file I sumbitted earlier, but a little more complex.
Hold on as I open the question and post the link here, then close the actual question and award you full points.
ASKER
Hi Sid,
Here's the other question:
https://www.experts-exchange.com/questions/26903378/Filter-old-expiration-dates.html
thanks again :)
Here's the other question:
https://www.experts-exchange.com/questions/26903378/Filter-old-expiration-dates.html
thanks again :)
ASKER
Thanks again so much for your fast help :)
Sid