I want to create an Excel macro using Finance data out of our ERP system.
Not all options in the "status" column are there every time I dump the data. The "status" column consists of things like: 'approved', 'rejected', 'awaiting approval', etc.
I want to first check whether 'rejected' is in the column before filtering (then I have different code triggering giving those cells a colour).
Because 'rejected' isn't always a status, the code stops and the macro doesn't finish.
ActiveSheet.Range("$A$1:$K$128").AutoFilter Field:=10, Criteria1:= _
"Rejected"
Range("H125").Select
Range(Selection, Selection.End(xlDown)).Select
'...(more code)
How can I let the filter only trigger when "rejected" is present in that column (column K)?