Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,570
- Office Version
- 365
- 2016
- Platform
- Windows
I need some help ...
I am receiving a "Subscript out of range" error with the line in red.
Worksheet "STAFF_SCHEDULE" is found in workbook alias wb_pstaff (which is recognized properly) and I wish to copy it to a newly created workbook (newbook) after "Sheet1"
Thoughts?
Rich (BB code):
Fpath = "U:\PWS\Parks\Parks Operations\Sports\WATSOP19\STAFF\BackupData\"
fname = "staff_schedule_BU (" & Format(Now, "dd-mm-yy hh,mm,ss") & ").xlsm"
Set newbook = Workbooks.Add
wb_pstaff.Worksheets("STAFF_SCHEDULE").Copy after:=newbook.Worksheets("Sheet1")
If Dir(Fpath & fname) <> "" Then
MsgBox "File " & Fpath & fname & " already exists.", vbExclamation, "FILE ERROR"
Else
newbook.SaveAs filename:=Fpath & fname
Set wb_staffschedulebu = Workbooks(fname)
MsgBox "Backup : " & fname & " secured.", vbInformation, "SUCCESS"
End If
wb_staffschedulebu.Close
I am receiving a "Subscript out of range" error with the line in red.
Worksheet "STAFF_SCHEDULE" is found in workbook alias wb_pstaff (which is recognized properly) and I wish to copy it to a newly created workbook (newbook) after "Sheet1"
Thoughts?