Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
KonaAl
 
Posts: n/a
Default Page Setup for multiple worksheets macro problem

Hi,

I've recorded a macro doing the following: group all worksheets, select
file|pagesetup, and then select my formatting, etc.

The formatting was successfully applied to all worksheets at this stage.
However when I try to run the macro, the formatting is only applied to the
first worksheet.

What gives?

Thanks.

Allan
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Page Setup for multiple worksheets macro problem

Are you Twirly?

Can you use a macro?

Option Explicit
Sub testme()
Dim wks As Worksheet
For Each wks In ActiveWindow.SelectedSheets
With wks
.PageSetup.PrintArea = "A1:X99"
End With
Next wks
End Sub

You have to group the worksheets that should have the same print area
before running the macro.

Click on the first worksheet tab and ctrl-click on subsequent.

And after, rightclick on one of the grouped sheets and select ungroup sheets.


If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm



KonaAl wrote:

Hi,

I've recorded a macro doing the following: group all worksheets, select
file|pagesetup, and then select my formatting, etc.

The formatting was successfully applied to all worksheets at this stage.
However when I try to run the macro, the formatting is only applied to the
first worksheet.

What gives?

Thanks.

Allan


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
KonaAl
 
Posts: n/a
Default Page Setup for multiple worksheets macro problem

Thanks so much Dave! -- works perfectly.

I'm not Twirly -- assuming that's a person! I'm familiar with macros but
the whole for:next thing had me stumped when I looked through the help files.

Thanks again.

Allan

"Dave Peterson" wrote:

Are you Twirly?

Can you use a macro?

Option Explicit
Sub testme()
Dim wks As Worksheet
For Each wks In ActiveWindow.SelectedSheets
With wks
.PageSetup.PrintArea = "A1:X99"
End With
Next wks
End Sub

You have to group the worksheets that should have the same print area
before running the macro.

Click on the first worksheet tab and ctrl-click on subsequent.

And after, rightclick on one of the grouped sheets and select ungroup sheets.


If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm



KonaAl wrote:

Hi,

I've recorded a macro doing the following: group all worksheets, select
file|pagesetup, and then select my formatting, etc.

The formatting was successfully applied to all worksheets at this stage.
However when I try to run the macro, the formatting is only applied to the
first worksheet.

What gives?

Thanks.

Allan


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Page Setup for multiple worksheets macro problem

Twirly(?) asked a very similar question just moments before you did. In fact, I
essentially copied and pasted my reply.

KonaAl wrote:

Thanks so much Dave! -- works perfectly.

I'm not Twirly -- assuming that's a person! I'm familiar with macros but
the whole for:next thing had me stumped when I looked through the help files.

Thanks again.

Allan

"Dave Peterson" wrote:

Are you Twirly?

Can you use a macro?

Option Explicit
Sub testme()
Dim wks As Worksheet
For Each wks In ActiveWindow.SelectedSheets
With wks
.PageSetup.PrintArea = "A1:X99"
End With
Next wks
End Sub

You have to group the worksheets that should have the same print area
before running the macro.

Click on the first worksheet tab and ctrl-click on subsequent.

And after, rightclick on one of the grouped sheets and select ungroup sheets.


If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm



KonaAl wrote:

Hi,

I've recorded a macro doing the following: group all worksheets, select
file|pagesetup, and then select my formatting, etc.

The formatting was successfully applied to all worksheets at this stage.
However when I try to run the macro, the formatting is only applied to the
first worksheet.

What gives?

Thanks.

Allan


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Svaing as Web Page Problem captainron19 Excel Discussion (Misc queries) 4 December 6th 05 06:18 PM
Page numbering problem clubin Excel Discussion (Misc queries) 7 November 18th 05 06:39 PM
Is there a way to apply "page setup" defaults to an existing work. Excel default page set up formats Excel Discussion (Misc queries) 2 March 21st 05 10:54 PM
can you set the "Page Setup" margins etc. differently for each pag Tony Excel Worksheet Functions 4 February 2nd 05 01:15 PM
How do I copy page setup from one worksheet & paste into new shee. Rasc0 Excel Discussion (Misc queries) 2 December 1st 04 10:12 PM


All times are GMT +1. The time now is 06:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"