View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Hans Hans is offline
external usenet poster
 
Posts: 25
Default Moving through sheets

Hello Keith

Below is a very simple Macro i wrote that gives every
sheet in a workbook the same print area. Instead of
the 'ws.PageSetup.PrintArea = "$A:$I"' you could enter
another routine.

Sub AllSheetsSamePrintArea()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.PageSetup.PrintArea = "$A:$I"
Next ws
End Sub

-----Original Message-----
I want to run a routine on each sheet in the workbook. As
the numberf of sheets may change, I would prefer not to
refer to them by name.

Can anyone advise on the With/End With or For / Next code
into which I can put my routine? So far I have got

Sub UpdateFalseNew()
Dim wrkBook As Workbook
Dim wrkSht As Sheets

wrkBook = ThisWorkbook

For Each wrkSht In wrkBook
wrkSht.Select
setupdatefalse
Next wrkSht

End Sub
.