Referencing the worksheet name in an excel function

Q

QuietMan

Does anyone mknow how I would reference "Sheet2" to a cell in a worksheet
Need to be able to change the worksheet name based on a cell

Thanks

='C:\Documents and Settings\FP&A\Templates\[SMP2Data.xls]Sheet2'!$A$1
 
C

Charles Williams

If you want to know the name of the sheet of a range passed as a parameter
use

Rnge.Parent.Name

If you want to know the name of the sheet that contain the call to the UDF
use
Application.Caller.Parent.Name

If you want to know the contents of a cell that contains a sheet name use
Rnge.Value

Be careful that all references to cells are passed as parameters to your
function so that Excel knows to recalculate your function whenever any of
the cells change. Otherwise you will have to make your function Volatile,
which is slow.

regards
Charles
__________________________________________________
The Excel Calculation Site
http://www.decisionmodels.com
 

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