Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default automatically get worksheet name

I am new to excel programming, and hope someone can help me out here.

I have a large excel workbook with many worksheet, I wish to use this
function and put worksheet name on the top of each sheet. The
function I have is RIGHT(CELL("filename")|LEN(CELL("filename"))-
FIND("]"|CELL("filename"))).
The problem is it doesn't automatically refresh when I move from sheet
to sheet.

Thank in advance,

John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default automatically get worksheet name

Hi,

You need to add a reference to the CELL function in order to get each
individual sheet.

=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1) )-FIND("]",CELL("filename",A1)))

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
wrote in message
...
I am new to excel programming, and hope someone can help me out here.

I have a large excel workbook with many worksheet, I wish to use this
function and put worksheet name on the top of each sheet. The
function I have is RIGHT(CELL("filename")|LEN(CELL("filename"))-
FIND("]"|CELL("filename"))).
The problem is it doesn't automatically refresh when I move from sheet
to sheet.

Thank in advance,

John


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default automatically get worksheet name

Hi,

ALT+F11 to open VB editor. Double click 'This Workbook' and paste this in on
the right. Change the cell reference to where you want the name

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Range("A1").Value = ActiveSheet.Name
End Sub

Mike

" wrote:

I am new to excel programming, and hope someone can help me out here.

I have a large excel workbook with many worksheet, I wish to use this
function and put worksheet name on the top of each sheet. The
function I have is RIGHT(CELL("filename")|LEN(CELL("filename"))-
FIND("]"|CELL("filename"))).
The problem is it doesn't automatically refresh when I move from sheet
to sheet.

Thank in advance,

John

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default automatically get worksheet name

Andy has given you the answer but FWIW this is a bit shorter

=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,31)

31 is the max length of a sheet name (at least in xl2003 and below)

Regards,
Peter T

wrote in message
...
I am new to excel programming, and hope someone can help me out here.

I have a large excel workbook with many worksheet, I wish to use this
function and put worksheet name on the top of each sheet. The
function I have is RIGHT(CELL("filename")|LEN(CELL("filename"))-
FIND("]"|CELL("filename"))).
The problem is it doesn't automatically refresh when I move from sheet
to sheet.

Thank in advance,

John



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default automatically get worksheet name



Thanks, it worked. I have to change "," to "|", using Excel 2007
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
automatically appending newly added data on worksheet to a master list worksheet tabylee via OfficeKB.com Links and Linking in Excel 0 December 17th 09 04:24 PM
Automatically Populating a Worksheet TS Excel Worksheet Functions 2 August 1st 08 11:19 PM
automatically change worksheet tab name wally Excel Worksheet Functions 9 June 28th 08 01:41 AM
Automatically number a worksheet Jim C. Excel Discussion (Misc queries) 1 September 23rd 05 11:44 PM
Automatically pasting worksheet data to new worksheet with formulas COntactJason Excel Worksheet Functions 0 August 10th 05 08:22 PM


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