copy name from active sheet to cell - using macro or function

D

dymek

Hello,

I'm newbie I'm looking for function or macro which can give copy name of
worksheet to cell in eg. A1.

Is it possible?

Of course function is the best option.

Thanks in advance.

Rgs,
dymek
 
O

Otto Moehrbach

=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))

OR:
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))
OR:
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,99)
OR:
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)
NOTE: The above 3 formulas do not work if the sheet name is the same
as the file name
without the .xls. IOW, if the sheet name is Able and the file name is
Able.xls, it won't work.
HTH Otto
 
B

Boo

Code you need is:

Cells(1, 1).Value = ActiveSheet.Name

Assign the macro to a shortcut key, object or event (depending on your
preference).
 
Top