Printing Help Needed

sinned141

Board Regular
Joined
May 4, 2009
Messages
115
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.

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
 
Yes they all have the same number of columns A:M
The columns which are being totaled are G:M
and there shouldn't ever be more than ten sheets I wouldn't have thought
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,215,221
Messages
6,123,699
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top