Good catch! I completely forgot about the possibility the sheet name might
get changed. As you indicated, this is how the code should have be
constructed...
Function TabName()
Application.Volatile vbTrue
TabName = ActiveSheet.Name
End Function
Thanks for catching that omission for me.
--
Rick (MVP - Excel)
"egun" wrote in message
...
Rick,
I also thought he might like the UDF solution, but didn't offer it because
he seemed to like the formula route well enough. However, when I created
the
UDF, it didn't always update when I manually CHANGED the sheet name. Then
I
added Application.Volatile vbTrue, and that seemed to make it work. Is
that
your experience also?
Thanks,
Eric
"Rick Rothstein" wrote:
Eduardo has given you a worksheet formula solution to your question;
however, since you posted your question in the "programming" newsgroup, I
thought you might be looking for a UDF (User Defined Function). The UDF
for
this question is quite simple...
Function TabName()
TabName = ActiveSheet.Name
End Function
To install the UDF, press Alt+F11 to go into the VB editor and click
Insert/Module from its menu bar, then copy/paste the above code into the
code window that opened up there. To use the UDF, just place this
formula...
=TabName()
into any cell that you want the TabName to appear in.
--
Rick (MVP - Excel)