Godders199
Active Member
- Joined
- Mar 2, 2017
- Messages
- 313
- Office Version
- 2013
Hello, I have written this maybe basic code, to filter a sheet by criteria selected in 3 cells, this works fine, however rather than go to a blank sheet with just the head rows when there are no cases, i would prefer a msg box to just say, "no matches , change criteria and search again" I have copied various codes i have found but not got any to work. Do i need to change my existing code? or is there something i can just add on the end.
With Sheets("cases available ").Range("a:ab")
If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilter.ShowAllData
.AutoFilter Field:=8, Criteria1:=Sheets("instructions ").Range("c23").Value, Operator:=xlFilterValues
.AutoFilter Field:=11, Criteria1:=Sheets("instructions ").Range("c35").Value, Operator:=xlFilterValues
.AutoFilter Field:=27, Criteria1:="=*" & Sheets("instructions ").Range("c26") & "*", Operator:=xlFilterValues
End With
Sheets("cases available ").Select
Any help as always appreciated.
With Sheets("cases available ").Range("a:ab")
If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilter.ShowAllData
.AutoFilter Field:=8, Criteria1:=Sheets("instructions ").Range("c23").Value, Operator:=xlFilterValues
.AutoFilter Field:=11, Criteria1:=Sheets("instructions ").Range("c35").Value, Operator:=xlFilterValues
.AutoFilter Field:=27, Criteria1:="=*" & Sheets("instructions ").Range("c26") & "*", Operator:=xlFilterValues
End With
Sheets("cases available ").Select
Any help as always appreciated.