I have the following code for an advanced filter
when running the code , I get a compile error "Else without if ' run time error
It would be appreciated if someone could kindly amend my code
when running the code , I get a compile error "Else without if ' run time error
It would be appreciated if someone could kindly amend my code
Code:
Sub Advanced_Filter()
Dim LR As Long
With Sheets(4)
LR = Range("A" & .Rows.Count).End(xlUp).Row
.Range("A1:G" & LR).ClearContents
End With
With Sheets(4)
Sheets("Vat%").Columns("A:G").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("'Vat Not 14%'!Criteria"), CopyToRange:=Range("A1"), _
Unique:=False
End With
If Range("A2") = "" Then Exit Sub
Else
With Sheets(4)
.Range("A:G").EntireColumn.AutoFit
End With
End Sub