Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default identify sheet number in header?

I have a workbook with 41 sheets. When printed out each sheet may be more
than one page. However, each sheet is a separate tab in a notebook. So I
wonder if there's a way to set up a header in such a way that the sheet
(i.e., tab) number prints.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,276
Default identify sheet number in header?

Hi,
In A1 enter this formula it will give the tab name then you will use it in
yours prints
=MID(CELL("filename",C1),FIND("]",CELL("filename",C1))+1,255)

"Steve" wrote:

I have a workbook with 41 sheets. When printed out each sheet may be more
than one page. However, each sheet is a separate tab in a notebook. So I
wonder if there's a way to set up a header in such a way that the sheet
(i.e., tab) number prints.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default identify sheet number in header?

I don't want the sheet name. I want the sheet number...1, 2, 3, etc.

"Eduardo" wrote:

Hi,
In A1 enter this formula it will give the tab name then you will use it in
yours prints
=MID(CELL("filename",C1),FIND("]",CELL("filename",C1))+1,255)

"Steve" wrote:

I have a workbook with 41 sheets. When printed out each sheet may be more
than one page. However, each sheet is a separate tab in a notebook. So I
wonder if there's a way to set up a header in such a way that the sheet
(i.e., tab) number prints.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default identify sheet number in header?

You want the codename/number of the sheet?

Sub sheetnumber()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
ws.PageSetup.CenterFooter = ws.CodeName
Next
End Sub


Gord Dibben MS Excel MVP

On Mon, 8 Dec 2008 12:57:00 -0800, Steve
wrote:

I don't want the sheet name. I want the sheet number...1, 2, 3, etc.

"Eduardo" wrote:

Hi,
In A1 enter this formula it will give the tab name then you will use it in
yours prints
=MID(CELL("filename",C1),FIND("]",CELL("filename",C1))+1,255)

"Steve" wrote:

I have a workbook with 41 sheets. When printed out each sheet may be more
than one page. However, each sheet is a separate tab in a notebook. So I
wonder if there's a way to set up a header in such a way that the sheet
(i.e., tab) number prints.


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default identify sheet number in header?

That's what I thought I wanted. However, after I created all of the
worksheets I rearranged them. So the codenames aren't sequential. For
example the first sheet in the workbook is actually sheet41. Maybe it's not
possible to do what I want to do. Thanks for trying, though.

"Gord Dibben" wrote:

You want the codename/number of the sheet?

Sub sheetnumber()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
ws.PageSetup.CenterFooter = ws.CodeName
Next
End Sub


Gord Dibben MS Excel MVP

On Mon, 8 Dec 2008 12:57:00 -0800, Steve
wrote:

I don't want the sheet name. I want the sheet number...1, 2, 3, etc.

"Eduardo" wrote:

Hi,
In A1 enter this formula it will give the tab name then you will use it in
yours prints
=MID(CELL("filename",C1),FIND("]",CELL("filename",C1))+1,255)

"Steve" wrote:

I have a workbook with 41 sheets. When printed out each sheet may be more
than one page. However, each sheet is a separate tab in a notebook. So I
wonder if there's a way to set up a header in such a way that the sheet
(i.e., tab) number prints.





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default identify sheet number in header?

You want the sheets' position numbers?

Sub sheetnumber()

Dim I As Integer, J As Integer

For I = 1 To Sheets.Count
For J = I To Sheets.Count
Sheets(J).PageSetup.CenterFooter = "sht " & I

Next J
Next I
End Sub


Gord

On Mon, 8 Dec 2008 13:55:01 -0800, Steve
wrote:

That's what I thought I wanted. However, after I created all of the
worksheets I rearranged them. So the codenames aren't sequential. For
example the first sheet in the workbook is actually sheet41. Maybe it's not
possible to do what I want to do. Thanks for trying, though.

"Gord Dibben" wrote:

You want the codename/number of the sheet?

Sub sheetnumber()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
ws.PageSetup.CenterFooter = ws.CodeName
Next
End Sub


Gord Dibben MS Excel MVP

On Mon, 8 Dec 2008 12:57:00 -0800, Steve
wrote:

I don't want the sheet name. I want the sheet number...1, 2, 3, etc.

"Eduardo" wrote:

Hi,
In A1 enter this formula it will give the tab name then you will use it in
yours prints
=MID(CELL("filename",C1),FIND("]",CELL("filename",C1))+1,255)

"Steve" wrote:

I have a workbook with 41 sheets. When printed out each sheet may be more
than one page. However, each sheet is a separate tab in a notebook. So I
wonder if there's a way to set up a header in such a way that the sheet
(i.e., tab) number prints.




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
Identify the row in which a MAX number in a column resides BarDoomed Excel Worksheet Functions 7 June 5th 08 08:23 PM
looking for formula to identify next non-empty cell on another sheet Pierre Excel Worksheet Functions 10 October 3rd 07 06:39 PM
Identify number of items with characterisitics from two columns [email protected] Excel Worksheet Functions 5 April 2nd 06 01:07 AM
VBA code to identify last row in a sheet SharonP. Excel Discussion (Misc queries) 4 February 17th 06 02:15 PM
Formula to Identify Column Number Michael Link Excel Discussion (Misc queries) 4 August 14th 05 03:18 PM


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

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"