Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Page X of Y in Worksheet

Good morning! I'm really hoping someone can assist me.
I have a worksheet with a title block in rows 1-13. This title block repeats
on each sheet. I would like for a cell to show when printed "Sheet 'x' of
'y'". Is this possible?

--
G. Hott
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Page X of Y in Worksheet

Try something like this:

I = 1;
For Each WkSheet in Application.ActiveWorkbook.Windows(1)
Range("A1:A1).Value = I
I = I + 1
Next

What is does is it goes through the worksheets in the current workbook that
is selected. Just in case you have more than one open workbook, and then
puts the value of I in cell A1. But you can have put whatever you want in
cell A1 or any other cell by changing the Range value.

--
Rui


"G.Hott" wrote in message
...
Good morning! I'm really hoping someone can assist me.
I have a worksheet with a title block in rows 1-13. This title block
repeats
on each sheet. I would like for a cell to show when printed "Sheet 'x' of
'y'". Is this possible?

--
G. Hott



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Page X of Y in Worksheet

Did you try putting this in the custom footer

Page &[Page] of &[Pages]

HTH,
Barb Reinhardt



"G.Hott" wrote:

Good morning! I'm really hoping someone can assist me.
I have a worksheet with a title block in rows 1-13. This title block repeats
on each sheet. I would like for a cell to show when printed "Sheet 'x' of
'y'". Is this possible?

--
G. Hott

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Page X of Y in Worksheet

Thanks, Barb, but this will not work. i cannot use a header or footer in this
application. the only form of a header i can have are the repeating 13 rows
at the top of each sheet. I would like the Sheet 'x' of''y' to be in one of
these cells.
--
G. Hott


"Barb Reinhardt" wrote:

Did you try putting this in the custom footer

Page &[Page] of &[Pages]

HTH,
Barb Reinhardt



"G.Hott" wrote:

Good morning! I'm really hoping someone can assist me.
I have a worksheet with a title block in rows 1-13. This title block repeats
on each sheet. I would like for a cell to show when printed "Sheet 'x' of
'y'". Is this possible?

--
G. Hott

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Page X of Y in Worksheet

Put this code in the Thisworkbook object, this will update the text each
time you print the file. Replace [A1] with the cell address you want to use

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim X As Integer, Y As Integer

Y = ThisWorkbook.Sheets.Count
For X = 1 To Y
Sheets(X).[A1].Value = "Sheet " & X & " of " & Y
Next X

End Sub

Paul D


"G.Hott" wrote in message
...
: Good morning! I'm really hoping someone can assist me.
: I have a worksheet with a title block in rows 1-13. This title block
repeats
: on each sheet. I would like for a cell to show when printed "Sheet 'x' of
: 'y'". Is this possible?
:
: --
: G. Hott




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 342
Default Page X of Y in Worksheet


I am guessing that you mean the title repeats on each printed page from one
single worksheet.
I am sceptical about doing this.
This is not dynamic.
But since you asked and I have been pondering this, the following code will
put "Page x of xx" in column "A" one line above each

horizontal page break. I have not tested it thoroughly, but it seems to
work. It is slow.

Sub AddPageNumbers()

Dim rngBreakLocation As Range
Dim intCounter As Integer

ActiveWindow.View = xlPageBreakPreview

For intCounter = 1 To ActiveSheet.HPageBreaks.Count

Set rngBreakLocation = ActiveSheet.HPageBreaks(intCounter).Location

rngBreakLocation.Offset(-1, 0).Value = "Page " _
& intCounter & " of " & ActiveSheet.HPageBreaks.Count

Next intCounter

ActiveWindow.View = xlNormalView

End Sub

Good Luck,

Tom

"G.Hott" wrote:

Good morning! I'm really hoping someone can assist me.
I have a worksheet with a title block in rows 1-13. This title block repeats
on each sheet. I would like for a cell to show when printed "Sheet 'x' of
'y'". Is this possible?

--
G. Hott

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Page X of Y in Worksheet

This isn't working. The cell i want the sheet 'x' of 'y' to print in is D11
so i changed the range to (D11:D11) is that correct?
I have two worksheets in the workbook but there is no reason to print from
the other sheet - however, it is essential to keep.
I'm putting this in the thisworkbook object - is that correct?
--
G. Hott


"ruic" wrote:

Try something like this:

I = 1;
For Each WkSheet in Application.ActiveWorkbook.Windows(1)
Range("A1:A1).Value = I
I = I + 1
Next

What is does is it goes through the worksheets in the current workbook that
is selected. Just in case you have more than one open workbook, and then
puts the value of I in cell A1. But you can have put whatever you want in
cell A1 or any other cell by changing the Range value.

--
Rui


"G.Hott" wrote in message
...
Good morning! I'm really hoping someone can assist me.
I have a worksheet with a title block in rows 1-13. This title block
repeats
on each sheet. I would like for a cell to show when printed "Sheet 'x' of
'y'". Is this possible?

--
G. Hott




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Page X of Y in Worksheet

Thanks - this seems to be the closest.
--
G. Hott


"ruic" wrote:
This is very close. However it's giving me the # of worksheets in the book.
What i need is the number of pages in the sheet. - Basically what you would
normally get by inserting page 'x' of 'y' in the header.
Thanks for helping me out.

Try something like this:

I = 1;
For Each WkSheet in Application.ActiveWorkbook.Windows(1)
Range("A1:A1).Value = I
I = I + 1
Next

What is does is it goes through the worksheets in the current workbook that
is selected. Just in case you have more than one open workbook, and then
puts the value of I in cell A1. But you can have put whatever you want in
cell A1 or any other cell by changing the Range value.

--
Rui


"G.Hott" wrote in message
...
Good morning! I'm really hoping someone can assist me.
I have a worksheet with a title block in rows 1-13. This title block
repeats
on each sheet. I would like for a cell to show when printed "Sheet 'x' of
'y'". Is this possible?

--
G. Hott




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
Unique Footer for each page in worksheet with a page number Keys2thecitY Excel Worksheet Functions 0 September 7th 09 06:06 AM
Page numbers on copies of a single page worksheet sr accountant Excel Discussion (Misc queries) 1 May 7th 07 06:29 PM
change cell size from page to page on the same worksheet Danny Excel Worksheet Functions 2 December 15th 05 06:20 PM
Converting a muliple page worksheet to a single page worksheet [email protected] Excel Discussion (Misc queries) 2 June 30th 05 09:40 PM
why would page 1 of an excel worksheet print smaller of page 2 if. hisdrama pest Excel Discussion (Misc queries) 1 January 10th 05 07:14 PM


All times are GMT +1. The time now is 12:40 AM.

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"