Tom Ogilvy, follow up for "coding for footer"

K

kathy

Hello Tom,
Thank you for reply. I am wondering what "GROUP" you mean. I found the
post below. They talked about your old post. But the link does not work
any more.

Based on what I found,I tried to use sheets.select, but I even can not
pass compiling. I know I am so new for excel programming. Any comments?
Public Sub tester()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws.PageSetup
.LeftHeader = "&A"
.LeftFooter = "Page &P of &N"
End With
Next ws
sheets.select
End Sub

Thanks.
Kathy

This is the post I found:
I didn't find much searching for information about grouping sheets, or

creating a list based on grouped sheets. The one article I did find
was
fairly helpful. It was posted by Tom Ogilvy and showed how to group
sheets
based on criteria in the sheetname. Found at:
http://groups.google.com/groupshl=en&lr=&safe=off&ic=1&th=c591933a15e...



This is my original post.
Hello,
I have 120 worksheets in one excel file.
I set print area in some sheets, some not.
I use macro to set up footer. Page number for the first 25 is right.
Then the next page number becomes 4,5,6,7...... ..
After several correct sequent pages, the
page number is wrong again. And repeat this again and again.....
Any comments?? Thanks.

Code is following:


Public Sub tester()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws.PageSetup
.LeftHeader = "&A"
.LeftFooter = "Page &P of &N"
End With
Next ws
End Sub
 
G

GS

Hi kathy,

Here's something you can use to group your sheets.


Sub GroupSheets()

Dim wks As Worksheet
Dim Shts() As String
Dim i As Integer

i = 0
For Each wks In ActiveWorkbook.Worksheets
'fill the array with names
ReDim Preserve Shts(0 To i)
Shts(i) = wks.Name
i = i + 1
Next

'select the array
ActiveWorkbook.Worksheets(Shts).Select

End Sub

HTH
Regards,
GS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top