Reputation: 25
Good afternoon! I'm having another issue, and can't seem to figure it out. In this way too long filter macro, I have code that looks for the active cell within a range, and if it's there, performs a filter:
ElseIf Not (Intersect(ActiveCell, OpenFindingsRange)) Then
SourceFindings.Select
'Unfilter data
Application.Goto (Sheets("Source-Findings").Range("A1"))
If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData
ActiveSheet.ListObjects("tblFindings").Range.AutoFilter Field:=6, Criteria1:=FilterOperatingGroup
ActiveSheet.ListObjects("tblFindings").Range.AutoFilter Field:=36, Criteria1:=OpenStatus
ActiveSheet.ListObjects("tblFindings").Range.AutoFilter Field:=37, Criteria1:="Yes"
If the active cell isn't in that range, it should go to the next Else If statement, but that's not happening. I'm getting the following error: Object variable or With block variable not set.
I can't get around this, and for whatever reason, I can't get error handling to bypass it.
Thoughts?
Thx!
Upvotes: 1
Views: 223
Reputation: 96753
Intersect(), as you are using it, will return a Range and not a Boolean.
Upvotes: 2