Hello, Please can someone help as I am about to through my computer out of the window and its a work machines so probably not a great idea. I have been trying to simply open a workbook and activate it so I can perform some filtering etc. When I run this from the code file there is no problem at all but when I come out of the file and click the workbook shortcut (as users would) I get an error stating "Method 'activate' of '_Object Workbook' failed. Not sure where i am going wrong with such a simple task. Any help would really help me. The code breaks on the line below I have in Red font.
Code:
Dim ShipmentTimelinessWeek As Workbook
Application.ScreenUpdating = False
If Dir("\\2.44.120.20\Felixstowe\Team KH\Timeliness report week.xlsx") = "" Then
MsgBox ("The Shipment Timeliness Report (GTN) was not found" & vbNewLine & _
"please make sure the file is saved to:" & vbNewLine & _
"\\2.44.120.20\Felixstowe\Team KH\Input Reports\")
Else
Set ShipmentTimelinessWeek = Workbooks.Open("\\2.44.120.20\Felixstowe\Team KH\Timeliness report week.xlsx")
End If
'***************************************************************************
'Delete any rows from Timeliness Report than are outside the date range
Workbooks("Timeliness report week.xlsx").Activate
With ActiveWorkbook.Worksheets("Shipment Timeliness")
.AutoFilterMode = False
With Range("F1", Range("F" & Rows.Count).End(xlUp))
.AutoFilter 1, Criteria1:="<" & GetDateRangeFrom, Operator:=xlOr, Criteria2:=">" & GetDateRangeTo
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
Bookmarks