B
Basta1980
Hi there,
I'm using an userform which gives an user the oppurtunity to fill in data
which is used to run the autofilter. There are 4 boxes the user can fill in.
One box (combobox1) is not optional, the rest (all the textboxes) is optional
i.e. the user gets to choose if they fill in the designated boxes or not. The
code below works when all boxes are filled in, but how do I get them to be
optional
Private Sub CommandButton1_Click()
TextBox1.SetFocus
Worksheets(ComboBox1.Value).Range("A1").AutoFilter _
field:=1, _
Criteria1:=TextBox1.Value
Worksheets(ComboBox1.Value).Range("A1").AutoFilter _
field:=5, _
Criteria1:=TextBox2.Value
Worksheets(ComboBox1.Value).Range("A1").AutoFilter _
field:=7, _
Criteria1:=TextBox3.Value
Worksheets(ComboBox1.Value).Activate
End Sub
Thnx in advance,
Basta1980
I'm using an userform which gives an user the oppurtunity to fill in data
which is used to run the autofilter. There are 4 boxes the user can fill in.
One box (combobox1) is not optional, the rest (all the textboxes) is optional
i.e. the user gets to choose if they fill in the designated boxes or not. The
code below works when all boxes are filled in, but how do I get them to be
optional
Private Sub CommandButton1_Click()
TextBox1.SetFocus
Worksheets(ComboBox1.Value).Range("A1").AutoFilter _
field:=1, _
Criteria1:=TextBox1.Value
Worksheets(ComboBox1.Value).Range("A1").AutoFilter _
field:=5, _
Criteria1:=TextBox2.Value
Worksheets(ComboBox1.Value).Range("A1").AutoFilter _
field:=7, _
Criteria1:=TextBox3.Value
Worksheets(ComboBox1.Value).Activate
End Sub
Thnx in advance,
Basta1980