I'm trying to select a YEAR and TYPE of business (1 or more) and then autofilter a column. That way I can use only 1 macro instead of making many for all the alternatives.
(Year Select)
(Type of Business)
This is what I have at the moment:
Private Sub Botton1_Click()
Public Platform As String
Public Year as Integer
Platform = UserForm1.LB2.Text
Year = UserForm1.LB1.value
Unload UserForm1
End Sub
......
Private Sub UserForm_Initialize()
With LB1
.AddItem "2016"
.AddItem "2017"
.AddItem "2018"
End With
With LB2
.AddItem "CMP"
.AddItem "AS"
.AddItem "MasterBread"
.AddItem "CMI -Andino"
.AddItem "CMI -Brasil"
.AddItem "CMI -CAMEC"
.AddItem "CMI -ConoSur"
.AddItem "Global"
End With
End Sub
The year will always be only 1 value but business type can be 1 or more.
How do I store multiple values of the listbox in order to call the variable as a filter?
This is were I need to call the variables:
ActiveSheet.Range("$A$1:$G$1500").AutoFilter Field:=4, Criteria1:="2016"
ActiveSheet.Range("$A$1:$G$1500").AutoFilter Field:=2, Criteria1:="=AS", _
Operator:=xlOr, Criteria2:="=MASTER BREAD"
In this example I needed to filter "2016" and "AS & MASTER BREAD".