PC Review


Reply
Thread Tools Rate Thread

automatically get worksheet name

 
 
johnzzhao@gmail.com
Guest
Posts: n/a
 
      15th Oct 2008
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
 
Reply With Quote
 
 
 
 
Andy Pope
Guest
Posts: n/a
 
      15th Oct 2008
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
<(E-Mail Removed)> wrote in message
news:f0dc611c-48e4-4bce-aa4f-(E-Mail Removed)...
>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


 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      15th Oct 2008
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

"(E-Mail Removed)" 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
>

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      15th Oct 2008
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

<(E-Mail Removed)> wrote in message
news:f0dc611c-48e4-4bce-aa4f-(E-Mail Removed)...
>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



 
Reply With Quote
 
johnzzhao@gmail.com
Guest
Posts: n/a
 
      15th Oct 2008


Thanks, it worked. I have to change "," to "|", using Excel 2007
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically update worksheet name JuneS Microsoft Excel Misc 2 3rd Jun 2010 10:37 PM
automatically populate worksheet Maggie Microsoft Excel Worksheet Functions 2 24th Feb 2009 09:11 PM
Automatically pasting worksheet data to new worksheet with formulas COntactJason Microsoft Excel Worksheet Functions 0 10th Aug 2005 08:22 PM
cut and copy automatically onto another worksheet =?Utf-8?B?TUlOQUwgWlVOS0U=?= Microsoft Access Getting Started 2 12th Jul 2005 06:47 PM
Automatically copying data from worksheet to worksheet GazMo Microsoft Excel Misc 3 22nd Sep 2004 02:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:15 PM.