Q about making a function

M

Microsoft Forum

Hi all,

I have written a function which displays a current sheet name in a cell. It
is very simple and it works fine.

However, I have a question. Suppose the function is called "SheetName" and
the current sheet is named "Sheet1".

I put "=SheetName()" in a cell and it properly display "Sheet1". However, if
I change the sheet name, then the function won't automatically do the
update. Any way to do the automation? Thanks a lot.

Frederick Chow
Hong Kong.
 
B

Bob Phillips

Frederick,

You can use built-in functions, which automatically update

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

--

HTH

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

Gary Brown

I agree that you should just use a formula. However, for future reference,
to update a function, you should use the 'Application.Volatile' Method. See
HELP.
--------------------------
Volatile Method Example

This example marks the user-defined function "My_Func" as volatile. The
function will be recalculated whenever calculation occurs in any cells on the
worksheet on which this function appears.

Function My_Func()
Application.Volatile
'
' Remainder of the function
'
End Function
 
M

Microsoft Forum

Gary,

Thanks a lot. I tried the method you mentioned last time but somehow it
didn't work. Now somehow it works. Thanks for your assistance.

Frederick Chow.
 

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

Top