Worksheet Name as a Variable

H

HamishM

Hi,

How do I use the name of the current worksheet i am in as a variabl
within a formula?

e.g.

IF value in column H = 'worksheet_name' return 'worksheet_name' a
value in cell x.

thanks,
Hamis
 
A

Andy Wiggins

You can use these formulas to extract data relating to your workbook. The
one you want is last in the list.

The file path and name
CELL("filename",A1)

The file path
LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1),1)-1)

The file name
MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,FIND("]",CELL("fil
ename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

The sheet name
RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename",
A1),1))

--

Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"
 

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