Workbook & worksheet name formulas

M

mikeburg

Is there a formula that obtains the workbook name that I can put in cel
A1?

Also,

Is there a formula that obtains the worksheet name that I can put i
cell A2?

Thanks so very much. mikebur
 
P

Peo Sjoblom

Workbook need to be saved

=SUBSTITUTE(MID(CELL("filename",B1),FIND("[",CELL("filename",B1))+1,255),"]"&MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,32),"")


for sheet


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



for path/name/sheet

=CELL("Filename",A1)

--
Regards,

Peo Sjoblom

(No private emails please)
 
M

mikeburg

Peo Sjoblom's vba works great!

One last request.

What formula would you recommend to show only the workbook name
worksheet name in a cell (A3 or whatever) separated only by a hyphen
. For example for a workbook named Payroll with a sheet named Rates:

Payroll-Rates

Thanks a million. mikebur
 
P

Peo Sjoblom

=formula1&" - "&formula2

where formula1 is the workbook name formula and formula 2 the worksheet name
formula
 
Top