VBA detect current worksheet print range?

Giga_Me

New Member
Joined
Jun 14, 2011
Messages
15
Hi all - here's a scenario I'm struggling to resolve: I have code that will create 10 additional worksheets based on criteria found in a master worksheet (all within the same workbook).

For the additional worksheets, I would like to set each one to match the master worksheet's print area and page setup options.

Here's code I'm working with:

Code:
Set WSNrange = Range(WSN.Cells(StartRow, 1), WSN.Cells(lastrow, 62))
WSO.Range(WSO.Cells(StartRow, 1), WSO.Cells(lastrow, 62)).Copy
WSNrange.PasteSpecial Paste:=xlPasteAll
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi Giga Me,

There might be an faster way, but one approach would be to have your code:
1. Copy the Master Worksheet
2. Clear all the Cells in the New Worksheet
3. Copy the Cleared Worksheet 9 more times.
 
Upvote 0
Jerry - that's yet another..."why didn't I think of that?" solution that keeps me coming back to this forum. :bow:

I'll have to rework my code but that'll be a quick fix.

Much appreciated.

Giga_Me
 
Upvote 0

Forum statistics

Threads
1,224,605
Messages
6,179,860
Members
452,948
Latest member
UsmanAli786

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