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
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Watch MrExcel Video

Forum statistics

Threads
1,118,760
Messages
5,574,087
Members
412,566
Latest member
TexasTony
Top