ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Tom Ogilvy, follow up for "coding for footer" (https://www.excelbanter.com/excel-programming/356135-tom-ogilvy-follow-up-coding-footer.html)

kathy

Tom Ogilvy, follow up for "coding for footer"
 

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...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


GS

Tom Ogilvy, follow up for "coding for footer"
 
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


All times are GMT +1. The time now is 08:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com