Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Getting name of sheet

Hi all

I would like to get the name of the sheet in cell A1, is there a
function for that?

Can I get it like this?

Function GetPageName()
GetPageName = Worksheets(5).Name
End Function

and use it in a cell like

=GetPageName( WhatDoI_needToPutHere? )

When printing, I want all pages to be landscape - how do I do that?
And the 2 upper lines, should read:

<page name pageno. < of pages
Headers....

WBR
Sonnich
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Getting name of sheet

Hi

Assuming you want to show the name of the current sheet use this:

Function GetPageName()
GetPageName = ActiveSheet.Name
End Function

=GetPageName()

To print in landscape goto File Page Setup Landscape

Use the header/footer option in the Page Setu Menu (other tab) to create
headers on each page.

Regards,
Per

"jodleren" skrev i meddelelsen
...
Hi all

I would like to get the name of the sheet in cell A1, is there a
function for that?

Can I get it like this?

Function GetPageName()
GetPageName = Worksheets(5).Name
End Function

and use it in a cell like

=GetPageName( WhatDoI_needToPutHere? )

When printing, I want all pages to be landscape - how do I do that?
And the 2 upper lines, should read:

<page name pageno. < of pages
Headers....

WBR
Sonnich


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Getting name of sheet

Hejsa

Function GetPageName()
* GetPageName = ActiveSheet.Name
End Function


But - when printing 6 pages, will they get their own name, or the
active sheets name?
Then I'll get 6 pages with the same name - not what I want

=GetPageName()

To print in landscape goto File Page Setup Landscape


yep, but is there an OnBeforePrint event, where I can force it?


Use the header/footer option in the Page Setu Menu (other tab) to create
headers on each page.


Can I force this too?

Med venlig hilsen
Sonnich
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Getting name of sheet

Hej Sonnich

When you say 6 pages, is it 6 tabs or 1 sheet with data for 6 printed pages.

As the function is non-volatile it won't update as other calculations, ie
entering the formula in a cell it will display the name of the sheet where
it's entered.

Worksheets("Sheet1").PageSetup.Orientation = xlLandscape

Turn on the macro recorder, then set up the header as desired. It should
look like this:

With ActiveSheet.PageSetup
.LeftHeader = "&A"
.CenterHeader = "Page &P of &N"
End With

Med venlig hilsen

Per

"jodleren" skrev i meddelelsen
...
Hejsa

Function GetPageName()
GetPageName = ActiveSheet.Name
End Function


But - when printing 6 pages, will they get their own name, or the
active sheets name?
Then I'll get 6 pages with the same name - not what I want

=GetPageName()

To print in landscape goto File Page Setup Landscape


yep, but is there an OnBeforePrint event, where I can force it?


Use the header/footer option in the Page Setu Menu (other tab) to create
headers on each page.


Can I force this too?

Med venlig hilsen
Sonnich

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
excel sheet bootom half sheet goes behind top part of sheet rob Excel Worksheet Functions 2 January 17th 09 01:28 AM
Duplicate sheet, autonumber sheet, record data on another sheet des-sa[_2_] Excel Worksheet Functions 0 May 8th 08 06:56 PM
Copying cells from on sheet to another sheet (via sheet module) CRayF Excel Programming 6 September 20th 05 08:58 PM
relative sheet references ala sheet(-1)!B11 so I can copy a sheet. RonMc5 Excel Discussion (Misc queries) 9 February 3rd 05 12:51 AM
Inserting a row in sheet A should Insert a row in sheet B, removing a row in Sheet A should remove the corresponding row in sheet B Hannes Heckner Excel Programming 1 March 5th 04 09:10 AM


All times are GMT +1. The time now is 05:11 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"