Hi
Please could someone look at my code and let me know what I'm doing wrong. I keep getting a runtime error (1004) and it's not saving. The title of the sheet is variable according to its reference number and the current date.
Many thanks in anticipation!
Please could someone look at my code and let me know what I'm doing wrong. I keep getting a runtime error (1004) and it's not saving. The title of the sheet is variable according to its reference number and the current date.
Code:
Sub McrCopyAndSave()
Dim MyFileNameSave As String
MyFolderPathPrefix = "O:\Planning\Team\MT\Packing lists\"
MyFolderPathDate = Sheets("Pivot").Range("Q1").Value
MyFileNameSave = MyFolderPathPrefix & MyFolderPathDate
Sheets("Pack list").Select
Sheets("Pack list").Copy
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("S2").Select
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:= _
MyFileNameSave, _
FileFormat:=1, CreateBackup:=False
Windows("Packing list.xlsm").Activate
End Sub
Many thanks in anticipation!