VB to number worksheets with 1 or more than pages

  • Thread starter Thread starter Jianexceltip
  • Start date Start date
J

Jianexceltip

I crated a following VB, but it did not work. I would appreciate if yo
could give me some tip.

Sub Number_Pages()
Dim PageNum as Integer
Workbooks.Open Filename:="C:\CAFR\FINANCLS\Gwide.xls"
UpdateLinks:=3
Sheets("NA").Select
Dim PageNum = 23
With ActiveSheet.PageSetup
.CenterFooter = "&P+PageNum”
PageNum = PageNum + 1
End With
End Su
 
CenterFooter = "&P+PageNum"

should be

CenterFooter = "&P" & PageNum

when the variable is enclosed in double quotes, it is a text string, not a
variable.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 

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

Back
Top