PC Review


Reply
Thread Tools Rate Thread

Worksheet Name in Cell

 
 
Shawn Shuler
Guest
Posts: n/a
 
      4th May 2005
I may be overlooking something simple but how can I echo the worksheet name
in a particular cell. FOr example, I want cell A1 to always contain the
name of the worheet that cell is a part of. Cell A1 of the worksheet
"SHEET1" would contain "SHEET1". I would need it to update if the sheet
name were changed as well.


 
Reply With Quote
 
 
 
 
JulieD
Guest
Posts: n/a
 
      4th May 2005
Hi Shawn

not all that simple
use this formula to put the sheet name in a cell
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))

BTW you need to save the workbook first.
--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"Shawn Shuler" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I may be overlooking something simple but how can I echo the worksheet name
> in a particular cell. FOr example, I want cell A1 to always contain the
> name of the worheet that cell is a part of. Cell A1 of the worksheet
> "SHEET1" would contain "SHEET1". I would need it to update if the sheet
> name were changed as well.
>
>



 
Reply With Quote
 
Andy Wiggins
Guest
Posts: n/a
 
      4th May 2005
The file path and name
CELL("filename",A1)

The file path
LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1),1)-1)

The file name
MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,FIND("]",CELL("fil
ename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

The sheet name
RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename",
A1),1))

--
Regards
-
Andy Wiggins FCCA
www.BygSoftware.com
Excel, Access and VBA Consultancy


"Shawn Shuler" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I may be overlooking something simple but how can I echo the worksheet

name
> in a particular cell. FOr example, I want cell A1 to always contain the
> name of the worheet that cell is a part of. Cell A1 of the worksheet
> "SHEET1" would contain "SHEET1". I would need it to update if the sheet
> name were changed as well.
>
>



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      4th May 2005


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Shawn Shuler" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I may be overlooking something simple but how can I echo the worksheet

name
> in a particular cell. FOr example, I want cell A1 to always contain the
> name of the worheet that cell is a part of. Cell A1 of the worksheet
> "SHEET1" would contain "SHEET1". I would need it to update if the sheet
> name were changed as well.
>
>



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      4th May 2005
See http://www.xldynamic.com/source/xld.xlFAQ0002.html

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Shawn Shuler" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I may be overlooking something simple but how can I echo the worksheet

name
> in a particular cell. FOr example, I want cell A1 to always contain the
> name of the worheet that cell is a part of. Cell A1 of the worksheet
> "SHEET1" would contain "SHEET1". I would need it to update if the sheet
> name were changed as well.
>
>



 
Reply With Quote
 
=?Utf-8?B?UGVvIFNqb2Jsb20=?=
Guest
Posts: n/a
 
      4th May 2005
Since a sheet name can only have 31 characters you can shorten that to

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

Regards,

Peo Sjoblom

"JulieD" wrote:

> Hi Shawn
>
> not all that simple
> use this formula to put the sheet name in a cell
> =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))
>
> BTW you need to save the workbook first.
> --
> Cheers
> JulieD
> check out www.hcts.net.au/tipsandtricks.htm
> ....well i'm working on it anyway
> "Shawn Shuler" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I may be overlooking something simple but how can I echo the worksheet name
> > in a particular cell. FOr example, I want cell A1 to always contain the
> > name of the worheet that cell is a part of. Cell A1 of the worksheet
> > "SHEET1" would contain "SHEET1". I would need it to update if the sheet
> > name were changed as well.
> >
> >

>
>
>

 
Reply With Quote
 
JulieD
Guest
Posts: n/a
 
      4th May 2005
Hi Peo

didn't know this, thanks

--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"Peo Sjoblom" <(E-Mail Removed)> wrote in message
news:CC014BD9-4BFC-41A3-8F2A-(E-Mail Removed)...
> Since a sheet name can only have 31 characters you can shorten that to
>
> =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,31)
>
> Regards,
>
> Peo Sjoblom
>
> "JulieD" wrote:
>
>> Hi Shawn
>>
>> not all that simple
>> use this formula to put the sheet name in a cell
>> =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))
>>
>> BTW you need to save the workbook first.
>> --
>> Cheers
>> JulieD
>> check out www.hcts.net.au/tipsandtricks.htm
>> ....well i'm working on it anyway
>> "Shawn Shuler" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> >I may be overlooking something simple but how can I echo the worksheet
>> >name
>> > in a particular cell. FOr example, I want cell A1 to always contain
>> > the
>> > name of the worheet that cell is a part of. Cell A1 of the worksheet
>> > "SHEET1" would contain "SHEET1". I would need it to update if the
>> > sheet
>> > name were changed as well.
>> >
>> >

>>
>>
>>



 
Reply With Quote
 
gord
Guest
Posts: n/a
 
      4th May 2005
What's wrong about this particular solution? Works nicely for me.

Private Sub Workbook_Open()
ThisWorkbook.Worksheets(1).Range("A1") = ThisWorkbook.Worksheets(1).Name

End Sub


Gord.


 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      4th May 2005
The OP wrote:

> Cell A1 of the worksheet "SHEET1" would contain "SHEET1". I would
> need it to update if the sheet name were changed as well.


Your solution won't update until the workbook is closed and reopened. It
also depends on macros being enabled.

In practice your solution may be adequate for the OP, but it doesn't
meet the specification.


In article <N6udnSdX6dJ4tOTfRVn-(E-Mail Removed)>,
"gord" <gord@no_spaming.com> wrote:

> What's wrong about this particular solution? Works nicely for me.
>
> Private Sub Workbook_Open()
> ThisWorkbook.Worksheets(1).Range("A1") = ThisWorkbook.Worksheets(1).Name
>
> End Sub

 
Reply With Quote
 
Shawn Shuler
Guest
Posts: n/a
 
      5th May 2005
I find that this one:

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

is the only one that updates automatically as the sheet name is changed.
EXACTLY what I was looking for.


"Andy Wiggins" <(E-Mail Removed) o m> wrote in message
news:(E-Mail Removed)...
> The file path and name
> CELL("filename",A1)
>
> The file path
> LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1),1)-1)
>
> The file name
>

MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,FIND("]",CELL("fil
> ename",A1),1)-FIND("[",CELL("filename",A1),1)-1)
>
> The sheet name
>

RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename",
> A1),1))
>
> --
> Regards
> -
> Andy Wiggins FCCA
> www.BygSoftware.com
> Excel, Access and VBA Consultancy
>
>
> "Shawn Shuler" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I may be overlooking something simple but how can I echo the worksheet

> name
> > in a particular cell. FOr example, I want cell A1 to always contain the
> > name of the worheet that cell is a part of. Cell A1 of the worksheet
> > "SHEET1" would contain "SHEET1". I would need it to update if the sheet
> > name were changed as well.
> >
> >

>
>



 
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
Linking cells containing text from one worksheet to a cell with textin another worksheet lizmatthews00774@gmail.com Microsoft Excel Discussion 8 10th Oct 2008 01:58 PM
link a cell in the 'Master' worksheet list to a 'Detail' worksheet =?Utf-8?B?UGF1bCBDb25kcm9u?= Microsoft Excel Programming 12 16th Jul 2006 11:41 PM
Place The Contents Of A Cell From The Active Worksheet Into A Cell On An Inavtive Worksheet Minitman Microsoft Excel Programming 1 25th Feb 2004 05:26 AM
Place The Contents Of A Cell From The Active Worksheet Into A Cell On An Inavtive Worksheet Minitman Microsoft Excel Worksheet Functions 1 25th Feb 2004 05:26 AM
Place The Contents Of A Cell From The Active Worksheet Into A Cell On An Inavtive Worksheet Minitman Microsoft Excel Misc 1 25th Feb 2004 05:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:35 AM.