Sheet Array for Printing

sdohertyccb

Board Regular
Joined
Feb 15, 2005
Messages
91
I am trying to write code that will find a dynamic array of sheets in a workbook and collect those to print, starting with Sheet(5) and finding all sheets after that. The number of sheets will change for each client depending on the number of salesmen for each. Any help you can give will be greatly appreciated. Thanks in advance for your help.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
As a starter maybe something like

Code:
Sub testPrint()
    Dim i As Long
 
    With ThisWorkbook
        If .Worksheets.Count < 5 Then Exit Sub
 
        For i = 5 To .Worksheets.Count
            'do your stuff like .Worksheets(i).PrintOut
            Debug.Print .Worksheets(i).Name
        Next i
    End With
 
End Sub

M.
 
Upvote 0
Thanks Marcelo for the quick reply.
I am wanting to print these out as a batch, so they will be in a single pdf file. I have the code for the pdf, but haven't been able to set the report array for all of the sheets.
I am trying something like this:
Code:
ReportArray = Sheets(Array(Sheet5, Sheet6, Sheet7...))
Worksheets (ReportArray).PrintOut
 
Last edited:
Upvote 0
Well, i am not sure if this

ReportArray = Sheets(Array(Sheet5, Sheet6, Sheet7...)
Worksheets (ReportArray).PrintOut

is possible


Maybe someone else can help you

M.
 
Upvote 0
Can anyone else help me with this problem? This is the final piece of a big project and am hoping to find a resolution soon....
Thanks for helping me out.
 
Upvote 0
Just in case anyone needs the answer to this problem, here is how I solved it:
Code:
Dim i as Integer
For i = 1 to ActiveWorkbook.Worksheets.Count Step 1
If i > 9 Then   'I want to start collecting sheets AFTER Sheet9
Sheets(i).Select Replace:=False
Else: End If
Next i
Application.Dialogs(xlDialogPrint).Show
 
Upvote 0

Forum statistics

Threads
1,223,632
Messages
6,173,472
Members
452,516
Latest member
archcalx

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