View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Selecting a worksheet based on the sheet Number

how about this?

Sub PrepSystemWide()
Application.ScreenUpdating = False
Dim sh As Worksheet
For Each sh In Worksheets(Array("Sheet1", "Sheet2", "Sheet3"))
sh.PageSetup.CenterFooter = "Page &P of &N"
Next
Sheet3.Select
Application.ScreenUpdating = True
End Sub


--


Gary

"QuietMan" wrote in message
...
Here is a sample the code Im working with...for some reason it will not
work....
Sub PrepSystemWide()
Application.ScreenUpdating = False
For X = 1 To 3
Select Case X
Case Is = 1: TTK = 40
Case Is = 2: TTK = 125
Case Is = 3: TTK = 127
End Select
Sht_Select = "Sheet" & TTK
Sheets(Sht_Select).Select
ActiveSheet.PageSetup.CenterFooter = "Page &P of &N"
Next X
Sheet3.Select
Application.ScreenUpdating = True
End Sub
--
Helping Is always a good thing


"Gary Keramidas" wrote:

this worked for me

Sub test()
Dim TTK As String
Dim Sht_Select As String
TTK = 2
Sht_Select = "Sheet" & TTK
Sheets(Sht_Select).Select
End Sub

--


Gary

"QuietMan" wrote in message
...
Can anyone tell me why the code does not work

TTK = 40
Sht_Select = "Sheet" & TTK
Sheets(Sht_Select).Select

Thanks

--
Helping Is always a good thing