Hi, I am running a macro in another workbook. This macro runs OK within it's own workbook but when I try to run it from another workbook I get a run-time error 9 subscript of out range.
If I opt for debug it seems to stop on the line in bold! Any idea why?
Sub CopyLatest()
'Updateby20140717
Dim szTodayDate As String
szTodayDate = Format(Date, "dd-mmm-yyyy")
On Error GoTo MakeSheet
Sheets(szTodayDate).Activate
Exit Sub
MakeSheet:
Sheets("Latest").Select
Sheets("Latest").Copy After:=Sheets("Mint")
ActiveSheet.Name = szTodayDate
Sheets("Latest").Select
End Sub
If I opt for debug it seems to stop on the line in bold! Any idea why?
Sub CopyLatest()
'Updateby20140717
Dim szTodayDate As String
szTodayDate = Format(Date, "dd-mmm-yyyy")
On Error GoTo MakeSheet
Sheets(szTodayDate).Activate
Exit Sub
MakeSheet:
Sheets("Latest").Select
Sheets("Latest").Copy After:=Sheets("Mint")
ActiveSheet.Name = szTodayDate
Sheets("Latest").Select
End Sub