Hi,
Seems like an easy issue, but I can't seem to find the right code to do what I'm after.
I have code that applies an auto filter to a certain column. What I want to do is apply an additional filter to a second column dependent on a cell value on another sheet.
The code below comes up with the following error:
Run-Time error '-2147417848 (80010108)'
Automation error
The object invoked has disconnected from its clients
I'm assuming this is because I'm trying to run an 'If' statement from within a 'With' statement. I've tried re-selecting/defining the sheet and range, but still no luck Can someone point me in the right direction please?
With Sheets("Sheet1")
.Activate
.AutoFilterMode = False
.Range("A:BP").AutoFilter
Selection.AutoFilter Field:=68, Criteria1:=Customer, Operator:=xlFilterValues
If Worksheets("Sheet3").Range("E6").Value = "Month" Then
Selection.AutoFilter Field:=7, Criteria1:=Mnth, Operator:=xlFilterValues
End If
.Range("A:B, D:D, U:U, BP:BP").Copy _
Destination:=Sheets("Sheet2").Cells
.Range("F:F, L:L").Copy _
Destination:=Sheets("Sheet2").Range("F1")
End With
Bookmarks