Hi,

If I want to filter the range of number and at the same time if i do not type anything in the input range, it will show me the whole table.However, my code got some problem in it. Hope you all can help me with it. Thank you!


Suppose:
'there will be the same ComboCode and same SubCode
'For example in the combocode column it has:
1122
1122
1122
1100
1100
1134
1134
1115
1127
When I type 1122 for the combocode and do not type anything for the subcode, the macro show me " there is no data". Can you help me with it? Thank you!

Below are my modified code:

Sub FilteredMultipleCriteria()
'declare the variables
Dim ComboCode As Integer
Dim SubCode As Integer
Dim rng As Range
'error handler
On Error GoTo errHandler:
'variables for sheet reference
ComboCode = Sheets("Interface").Range("E10").Value
SubCode = Sheets("Interface").Range("G10").Value

'variable for sheet objects
Set rng = Sheets("Database").Range("A2")
'add wildcard if valaues are empty
If ComboCode = "" Then ComboCode = "*"
If SubCode = "" Then SubCode = "*"

'run the filters

rng.AutoFilter Field:=7, Criteria1:=SubCode & "*"
rng.AutoFilter Field:=9, Criteria1:=ComboCode & "*"

'copy the range
CopyFilter
'show all the values
Showall
Sheets("Interface").Select
'error block
On Error GoTo 0
Exit Sub
errHandler:
MsgBox "There is no data"
Showall
Sheets("Interface").Select
End Sub