Filtering via a User Form

eggtimer

Board Regular
Joined
Apr 16, 2003
Messages
125
Hi

I am aiming to create a user form that can be used to filter data. The data needs to be filtered on two criteria the first is the Month and the second is the Salesperson

I have created two sets of Radio buttons and put them into group boxes and have attached some code to filter the groups. I was going fine except for I don’t know how to get the second criteria to follow the first, below is a section of my code

As I am sure someone with knowledge can see, If I select my first Radio button, I can get all the records for that month, but when I select the second it gives me all the records for that Salesman and I want only the records for that Salesman for that month.

As my intention for this is to make it swift and easy for users I would like it to change as they go, so whichever buttons they select in whatever order, Month or Agent, they will be returned the selected result.


Private Sub OptionButton13_Click()
Rows("4:10015").Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="John Smith"
End Sub

Private Sub OptionButton15_Click()
Rows("4:10015").Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="Dave Jones"
End Sub

Private Sub OptionButton4_Click()
Rows("4:10015").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="Apr-06"
End Sub

Private Sub OptionButton12_Click()
Rows("4:10015").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="Dec-06"
End Sub


Any help would be appreciated

Cheers
Wayne
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,214,402
Messages
6,119,299
Members
448,885
Latest member
LokiSonic

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