Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to update page footer number

Hi,

I'm trying to figure out how to withe a macro that automaticall
inserts in the page footer/header the page number when a worksheet ha
more than one page.

I know how to do this manualy. As an example, if in Print Preview show
2 pages, and I want that the page number should start in that workshee
at no. 2, then:: View/Header and Footer/Custom Header/Cente
Section/[&Page]+1.

The question is again: how can this thing be done using a macro?
I tryied something like
ActiveSheet.PageSetup.CenterFooter = "&P"+1 but I get an error message
"Type mismath"

Thanks for any help

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default macro to update page footer number

ActiveSheet.PageSetup.CenterFooter = "&P+1 "

Notice the extra space following the 1.

Ron de Bruin just posted this for someone else:

http://support.microsoft.com/default...kb;en-us;48198
XL: Setting Starting Page Number in Header/Footer


And you could get the total pages in the print preview and use it like:

Option Explicit
Sub testme01()

Dim TotalPages As Long

TotalPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
ActiveSheet.PageSetup.CenterFooter = "&P+" & TotalPages & " "

ActiveSheet.PrintOut preview:=True

End Sub


(and notice that same old extra space, too!)

"Adi_tca <" wrote:

Hi,

I'm trying to figure out how to withe a macro that automatically
inserts in the page footer/header the page number when a worksheet has
more than one page.

I know how to do this manualy. As an example, if in Print Preview shows
2 pages, and I want that the page number should start in that worksheet
at no. 2, then:: View/Header and Footer/Custom Header/Center
Section/[&Page]+1.

The question is again: how can this thing be done using a macro?
I tryied something like
ActiveSheet.PageSetup.CenterFooter = "&P"+1 but I get an error message:
"Type mismath"

Thanks for any help.

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to update page footer number

Hi Dave,

Thanks a lot. Before your reply I tryied something similar as yo
suggested, but didn't knew about the extra space...

BR/Adria

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format page number in excel footer to start at a specific page # straitctrydncr Excel Discussion (Misc queries) 4 April 28th 23 07:45 PM
Unique Footer for each page in worksheet with a page number Keys2thecitY Excel Worksheet Functions 0 September 7th 09 06:06 AM
Continuation of Page number in footer Junaid Excel Worksheet Functions 2 January 25th 09 11:41 AM
Page Number - not in header/footer hardtop Excel Discussion (Misc queries) 1 November 22nd 07 12:49 PM
Automatic update of footer macro Greg Excel Worksheet Functions 2 October 19th 07 01:22 AM


All times are GMT +1. The time now is 01:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"