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
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