Grouping together Sheets to create multiple pdfs

Etv5002

New Member
Joined
Sep 15, 2011
Messages
30
I have a book with regional managers listed horizontally on row 2. Currently there are 15 managers so there are 15 columns, one for each one of them.

under each managers name is a list of their stores, the name of the stores is the exact same as the individual stores sheet name.

Ie.
Dave
Store 2
Store 6
Stor2 67

I would like to group the individual sheets into PDFs so they can be distributed to the Managers.

Currently I'm facing an issue with the array, if a cell is blank then the array errors out. All the managers have different numbers of stores ranging from 2-16 each.

Code:
Sub SToPDF()

Dim OriginalSheet As String
Dim Sh1 As String
Dim Sh2 As String
'Dim Sh3 As String
'Dim Sh4 As String
'Dim Sh5 As String
'Dim Sh6 As String
'Dim Sh7 As String
'Dim Sh8 As String
'Dim Sh9 As String
'Dim Sh10 As String
'Dim Sh11 As String
'Dim Sh12 As String
'Dim Sh13 As String
'Dim Sh14 As String
'Dim Sh15 As String


    Sh1 = Sheets("Dp List").Cells(4, 2).Value
    Sh2 = Sheets("Dp List").Cells(5, 2).Value
'    Sh3 = Sheets("Dp List").Cells(6, 2).Value
'    Sh4 = Sheets("Dp List").Cells(7, 2).Value
'    Sh5 = Sheets("Dp List").Cells(8, 2).Value
'    Sh6 = Sheets("Dp List").Cells(9, 2).Value
'    Sh7 = Sheets("Dp List").Cells(10, 2).Value
'    Sh8 = Sheets("Dp List").Cells(11, 2).Value
'    Sh9 = Sheets("Dp List").Cells(12, 2).Value
'    Sh10 = Sheets("Dp List").Cells(13, 2).Value
'    Sh11 = Sheets("Dp List").Cells(14, 2).Value
'    Sh12 = Sheets("Dp List").Cells(15, 2).Value
'    Sh13 = Sheets("Dp List").Cells(16, 2).Value
'    Sh14 = Sheets("Dp List").Cells(17, 2).Value
'    Sh15 = Sheets("Dp List").Cells(18, 2).Value
    
    Sheets(Array(Sh1, Sh2)).Select
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\Users\evanderheof\Desktop\" & Sheets("Dp List").Range("b2").Value & ".pdf"


    'Reset location
    Sheets("Dp List").Select


End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

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