![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 04:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com