How could I change the textbox1 line to achieve this?
Any help on this would be kindly appreciated.
Thanks in advance.
Code: Select all
Private Sub FilterData()
Dim Region As String
Dim Item_Type As String
Dim myDB As Range
With Me
If .TextBox1.Value < 0 Or .TextBox2.Value < 0 Then Exit Sub
Region = .TextBox1.Value
Item_Type = .TextBox2.Value
End With
With ActiveWorkbook.Sheets("mysheet")
Set myDB = .Range("A1:D1").Resize(.Cells(.Rows.Count, 1).End(xlUp).Row)
End With
With myDB
.AutoFilter 'remove filters
.AutoFilter Field:=1, Criteria1:=Region ' filter data
.SpecialCells(xlCellTypeVisible).AutoFilter Field:=3, Criteria1:=Item_Type ' filter data again
Call UpdateListBox(Me.MyListbox, myDB, 1)
.AutoFilter
End With
End Sub