Seems pretty straightforward and has worked in the past, but now I'm getting an error when attempting to activate the 'Stats' worksheet.
Here's the pertinent part of the code with the failure commented:
The sheet is present in the active workbook - the code had just pulled data from the OCC Snapshot sheet right before this error.
Here's the pertinent part of the code with the failure commented:
VBA Code:
Set MTReportwb = ActiveWorkbook
MTReport = ActiveWorkbook.Name
'Grab and move OCC Snapshot data
Sheets("OCC Snapshot").Activate
Cells.Copy
Workbooks(YSName).Activate
Sheets("Data 2").Activate
If TodayDate <> FDNM Then
Range("A1").PasteSpecial xlPasteValues
End If
'Grab and move current month data
Workbooks(MTReport).Activate
[COLOR=rgb(0, 0, 0)]Sheets("Stats").Activate 'Failure debugs to here...[/COLOR]
Range("A5:T35").Copy
Workbooks(YSName).Activate
Sheets("Data 1").Activate
Range("A32").PasteSpecial xlPasteValues
'Close Multi-Tool report
Application.CutCopyMode = False
MTReportwb.Close Savechanges:=False
Sheets("Data Merge Current").Activate
The sheet is present in the active workbook - the code had just pulled data from the OCC Snapshot sheet right before this error.