Tab Names

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Is it possible to have Excel populate a cell (for example A1) with the name
of that worksheet tab? This could then be used across the rest of the book.


Many thanks
 
Hi Andy,

There may be a much easier way todo this, but you can paste the below into a
module:

Public Function tab_name()
tab_name = ActiveSheet.Name
End Function

then in A1 enter = tab_name()

This will return the tab name into call A1 but if you make a change to the
tabs name, you will have to re-enter the formula as it won't autocalc.

Thanks,

Simon
 
Thank guys both great!



smw226 via OfficeKB.com said:
Hi Andy,

There may be a much easier way todo this, but you can paste the below into a
module:

Public Function tab_name()
tab_name = ActiveSheet.Name
End Function

then in A1 enter = tab_name()

This will return the tab name into call A1 but if you make a change to the
tabs name, you will have to re-enter the formula as it won't autocalc.

Thanks,

Simon
 
I think I'd use:

Option Explicit
Public Function tab_name()
tab_name = Application.Caller.Parent.Name
End Function

If I were using the UDF. Activesheet.name will be the name of the
activesheet--not always the sheet containing the formula.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top