Printing same selection of data on various worksheets in a worksheet order determined by a list

Rebeccahannigan

New Member
Joined
May 13, 2015
Messages
3
Hello

I am having trouble achieving the following and have searched through the forums without a clear answer.

I have an excel document with 16 worksheets and a front page. On this front page I want to include a list that has the numbers 1-16 on it but in a different order (not alphanumerical) and when I push a button for excel to print the selection from each of those worksheets (as an example a:1-a:40) in the worksheet order determined by that list

Any help appreciated :)
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hello,

I have assumed your 'front page' is called Sheet1 and the numbers 1-16 are in cells A1:A16. Also assumed your 'front page' is the left most tab in your spreadsheet.

Code:
Sub print_sheets_2()
    For MY_ROWS = 1 To Range("A" & Rows.Count).End(xlUp).Row
        Sheets(Range("A" & MY_ROWS).Value + 1).Select
        ActiveSheet.PageSetup.PrintArea = "$A$1:$A$40"
        ActiveWindow.SelectedSheets.PrintPreview
        Sheets("Sheet1").Select
    Next MY_ROWS
End Sub

you will need to supply the code line to PRINT, as this can be different (and I'm not connected to a printer).

Is this any use?
 
Upvote 0
Hello There

I'll give it a shot - Would I just apply this to a button to hit print?
You'll have to bear with me a tad, I'm self taught so not that great at all this

Thanks
 
Upvote 0
Coming up with error code 13

cells that display the print order of sheets are b29-b44. Tried changing this range and didn't work. Error appears on the coding line Sheets(Range("A" & MY_ROWS).Value + 1).Select

Any help much appreciated!
 
Upvote 0
Hello,

does this work?

Code:
Sub print_sheets_2()
    For MY_ROWS = 29 To 44 'Range("B" & Rows.Count).End(xlUp).Row
        Sheets(Range("B" & MY_ROWS).Value + 1).Select
        ActiveSheet.PageSetup.PrintArea = "$A$1:$A$40"
        ActiveWindow.SelectedSheets.PrintPreview
        Sheets("Sheet1").Select
    Next MY_ROWS
End Sub

should you list of sheets exceed row 44, remove the 44 ' from the code line.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

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