Here goes nothing.
![]()
Private Sub CmdPrint_Click() Dim DateString As String Dim FolderName As String Dim x As Long Dim FileFormatNum As Long Application.ScreenUpdating = False DateString = Format(Now, "dd mmmm yyyy") FolderName = "C:\Users\Alison\OneDrive - Royal Hospital School\Documents\Timetable WIP\2019-20\Staffing Grids for HoDs" & " " & DateString For x = 0 To LstPrint.ListCount - 1 If LstPrint.Selected(x) = True Then Application.CopyObjectsWithCells = False With Sheets(LstPrint.List(x)) If .ProtectContents = True Then .Unprotect .Copy , Sheets(Sheets.Count) .Protect Else .Copy Sheets(Sheets.Count) End If End With Application.CopyObjectsWithCells = True With Sheets(Sheets.Count) .Range("H1").Value = LstPrint.List(x) .Range("B2:U4").Value = .Range("B2:U4") .Range("E94:U104").Value = .Range("E94:U104").Value .Copy End With With ActiveWorkbook .Sheets(1).Protect .Sheets(1).Name = LstPrint.List(x) If .HasVBProject Then FileFormatNum = 52 Else FileFormatNum = 51 End If .SaveAs FolderName & "\" & LstPrint.List(x), FileFormatNum .Close False End With End If Next Application.DisplayAlerts = False Sheets(Sheets.Count).Delete Application.DisplayAlerts = True Application.ScreenUpdating = True Unload Me End Sub
Bookmarks