Computing.Net > Forums > Office Software > how to show aTAB name in a cell?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

how to show aTAB name in a cell?

Reply to Message Icon

Name: amoralis
Date: August 19, 2009 at 12:59:57 Pacific
OS: Windows XP
Product: Microsoft Excel 2007
Subcategory: General
Tags: TAB, cell, value, present, excel 2007
Comment:

hi

anyone can say how to:
- show a TAB name in a cell?

=?



Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: August 19, 2009 at 16:47:37 Pacific
Reply:

Two ways:

1 - With a User Defined Function (UDF)

Put this code in a regular module of the VBA editor:

Function TabName()
  TabName = ActiveSheet.Name
End Function

In any cell put:

=TabName()

2 - By using the CELL() function

=CELL("filename",A1) will return the full path, including the Sheet Name, of the location of A1 in the sheet the function is used in. e.g.

C:\Documents and Settings\username\My Documents\[Book1.xls]Sheet1

Note: The file must be saved first for it to work.

Now you can use MID() to strip off everything except the sheet name:

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


0

Response Number 2
Name: amoralis
Date: August 21, 2009 at 18:46:55 Pacific
Reply:

hi DerbyDad03

=TABNAME() - doesn't work
=CELL("filename... - can't be used. i constantly save updated versions with naming xxx 1.00. changing it every time is too hard.

any other solutions?

thnx


0

Response Number 3
Name: Mike (by mmcconaghy)
Date: August 21, 2009 at 19:22:30 Pacific
Reply:

Try using a Defined Name combined with DerbyDad03’s =MID function:


On the Task Bar
Insert
Name
Define

In the Define Name slot enter:

Tabname

In the Refers to slot at the bottom enter:

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

Click OK


Select any cell you like and enter:

=Tabname

and the current Tab name should appear.

MIKE

http://www.skeptic.com/


0

Response Number 4
Name: DerbyDad03
Date: August 21, 2009 at 19:57:23 Pacific
Reply:

re: =TABNAME() - doesn't work

It might help if you explained what doesn't work/what happens. It works fine for me when placed in a regular module within the VBA editor.

re: =CELL("filename... - can't be used

You do realize that I meant to use the word "filename" as written, quotes included, not the name of your file, don't you?

Using the argument "filename" with the CELL function picks up the whatever is the current name of the file as long as it has been saved at least once.

In other words, it's not:

=CELL("Book1.xls",A1)

it's

=CELL("filename",A1)

which will return:

C:\Documents and Settings\username\My Documents\[Book1.xls]Sheet1

or whatever is the actual path to the file Book1.xls

See here for other CELL() arguments:

http://www.techonthenet.com/excel/f...


0

Response Number 5
Name: amoralis
Date: August 22, 2009 at 04:50:57 Pacific
Reply:

hi
thanks for patience :-)

it's simple:
- my excel has columns with info.
- one sheet per client
- one sell above has client #, that belongs to the sheet.

normally I name tabname and the sell with client number, but it becomes too big to do it manually. so I would like to automate input in cell in sheet from tabname of same tab.

P.S.
using function with A1 is not what I want, since I do not connect auto relationship yet, between main sheet and tabs


0

Related Posts

See More



Response Number 6
Name: Mike (by mmcconaghy)
Date: August 22, 2009 at 08:15:54 Pacific
Reply:

You've got me confused.

Can you give a before and after example.

MIKE

http://www.skeptic.com/


0

Response Number 7
Name: DerbyDad03
Date: August 22, 2009 at 08:29:33 Pacific
Reply:

I'm as confused as Mike is, but I'll mention this:

The A1 in the Cell function is only there so the CELL function as has a range address to work with. You could us any - absoultely any - cell reference in the function.

=CELL("filename",A1)
=CELL("filename",Z10)
=CELL("filename",AR78)
=CELL("filename",IV65535)

These will all return the same thing: the full path to Sheet, including the directory path, the workbook name and the sheet name.

The reference to a cell is only there so that the CELL function knows what to use to build the path.

Have you actually tried anything that I've suggested?


0

Response Number 8
Name: amoralis
Date: August 22, 2009 at 10:22:39 Pacific
Reply:

can i post a screenshot here?


0

Response Number 9
Name: Mike (by mmcconaghy)
Date: August 22, 2009 at 10:30:02 Pacific
Reply:

No, but you can post a link.

MIKE

http://www.skeptic.com/


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: how to show aTAB name in a cell?

How to specify the name in a group? www.computing.net/answers/office/how-to-specify-the-name-in-a-group/1507.html

How to create combo box in excel www.computing.net/answers/office/how-to-create-combo-box-in-excel/8048.html

how to insert blank space in data validation? www.computing.net/answers/office/how-to-insert-blank-space-in-data-validation/8607.html