LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default adding a page number in a cell

i have found a little routine that almost does what i want he

http://www.microsoft.com/office/comm...xp=&sloc=en-us

but what i need is for it to print one page and then the next page after
updating that cell. here is the code that i borrowed from that thread:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim AnySheet As Worksheet
Dim myRange As Range
Dim CellRange As Object

For Each AnySheet In ActiveWindow.SelectedSheets
'change "Sheet1" to actual sheet name
If AnySheet.Name = "Sheet1" Then
Set myRange = AnySheet.Range("I7")
For Each CellRange In myRange
CellRange.Value = CellRange.Value + 1
Next
End If
Next
'delete the next line to
'actually let it print out
'this is here just for testing
'Cancel = True
End Sub

it works in incrementing the cell, but it doesnt print the first page then
update the cell and print the second.

basically i need this for an invoice where the page number is located in the
middle of the page rather than in the header or footer.
 
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
How to display current page number in any cell of that page. Laljeet Excel Discussion (Misc queries) 8 February 2nd 08 01:31 AM
sheet tabs as page number and in a cell page of pages? [email protected] Excel Discussion (Misc queries) 0 November 22nd 05 02:43 PM
macro adding a number to a number already in a cell Tom Ogilvy Excel Programming 0 October 18th 03 04:34 PM
macro adding a number to a number already in a cell Don Guillett[_4_] Excel Programming 0 October 17th 03 05:21 PM
macro adding a number to a number already in a cell Ron de Bruin Excel Programming 0 October 17th 03 04:59 PM


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

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

About Us

"It's about Microsoft Excel"