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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
=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
 
Code you need is:

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

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

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

Back
Top