Hi all
I have recorded the following code on my master copy sheet however I would like to be able to print off all sheets which start with "BOQ Block" using the same layout, is there a way I can do this using a macro?
there are a different number of sheets each time so I cant just record it as I have done with this.
Many Thanks
I have recorded the following code on my master copy sheet however I would like to be able to print off all sheets which start with "BOQ Block" using the same layout, is there a way I can do this using a macro?
there are a different number of sheets each time so I cant just record it as I have done with this.
Code:
Sub PrintMe()
'
' PrintClientCopy Macro
' This Prints The First BOQ sheet
'
Application.ScreenUpdating = False
Columns("E:J").Select
Selection.EntireColumn.Hidden = True
Range("Table1[[#Headers],[ITEM]]").Select
ActiveSheet.ListObjects("Table1").ShowTotals = True
Range("Table1[[#Totals],[MATERIAL]:[TOTAL]]").Select
ActiveSheet.ListObjects("Table1").ListColumns("TOTAL").TotalsCalculation = _
xlTotalsCalculationSum
ActiveSheet.ListObjects("Table1").ListColumns("MATERIAL").TotalsCalculation = _
xlTotalsCalculationSum
ActiveSheet.ListObjects("Table1").ListColumns("lABOUR").TotalsCalculation = _
xlTotalsCalculationSum
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$7"
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.RightHeader = "&G"
.LeftFooter = _
"&8&K00-049Anything" & Chr(10)
.CenterFooter = "Page &P of &N"
.RightFooter = "&K00-049&F"
.PrintComments = xlPrintSheetEnd
.Orientation = xlPortrait
.FitToPagesWide = 1
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
End With
Application.PrintCommunication = True
ActiveWindow.View = xlPageLayoutView
ActiveWindow.SmallScroll Down:=0
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$7"
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.RightHeader = "&G"
.LeftFooter = _
"&8&K00-049Anything" & Chr(10)
.CenterFooter = "Page &P of &N"
.RightFooter = "&K00-049&F"
.Orientation = xlPortrait
.PaperSize = xlPaperA4
.FitToPagesWide = 1
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
End With
Application.PrintCommunication = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
ActiveWindow.View = xlNormalView
Columns("D:K").Select
Range("K1").Activate
Selection.EntireColumn.Hidden = False
Range("A1").Select
ActiveSheet.ListObjects("Table1").ShowTotals = False
Application.ScreenUpdating = True
End Sub
Many Thanks