View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Karin Karin is offline
external usenet poster
 
Posts: 125
Default Macro to Select All Sheets and Make Change to Footer

It seems to go to next sheet and on from there without changing the sheet you
are on or the sheets before it.

"Jim Thomlinson" wrote:

There is a problem wiht doin a pagesetup to all sheets. VBA can only do it
one sheet at a time... Your code is equivalent to

Worksheets.Select
Activesheet.PageSetup.RightFooter = "" '**Activesheet only
Sheets(1).Select
Range("A1").Select

Try this... It does not select anything so your user will be left exactly
where they were when the started the macro.

Sub test()
Dim wks As Worksheet

For Each wks In Worksheets
wks.PageSetup.RightFooter = ""
Next wks
End Sub

--
HTH...

Jim Thomlinson


"Karin" wrote:

Hi, I need help with this code, please. I want to select all the sheets in
one workbook and change the right footer to nothing, then select the A1 on
the first worksheet. What am I missing? Thank you!

Worksheets.Select
PageSetup.RightFooter = ""
Sheets(1).Select
Range("A1").Select