Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Q about making a function

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Q about making a function

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)


"Microsoft Forum" wrote in message
...
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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Q about making a function

Hi
use a formula for this. See:
http://www.xldynamic.com/source/xld.xlFAQ0002.html

--
Regards
Frank Kabel
Frankfurt, Germany
"Microsoft Forum" schrieb im Newsbeitrag
...
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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Q about making a function

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
--------------------------

"Microsoft Forum" wrote:

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.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Q about making a function

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.


"Gary Brown" wrote in message
...
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
--------------------------

"Microsoft Forum" wrote:

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.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
function Making one row out of many dersonnenach Excel Discussion (Misc queries) 2 March 30th 10 05:40 PM
Would like help making a function Sarah H.[_2_] Excel Discussion (Misc queries) 4 November 16th 09 04:14 PM
Making name of worksheet a function Anna in Istanbul Excel Worksheet Functions 1 March 13th 09 09:22 AM
Is there anybody who can hlp in the function making!!! rony4icab Excel Worksheet Functions 3 May 17th 06 05:35 AM
Making a function somewhat volatile. Bura Tino Excel Programming 3 May 4th 04 08:42 AM


All times are GMT +1. The time now is 05:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"