PDA

View Full Version : Insert the name of the worksheet in cell and than link the cell to another worksheet



alexm
07-23-2012, 12:28 AM
Hello,

I want to know if there is a way to insert the name of the worksheet in a cell, i've done it with this formula:
=MID(CELL("filename");SEARCH("[";CELL("filename"))+1;SEARCH(".xl?]";CELL("filename"))-SEARCH("[";CELL("filename"))-1)

The formula works, it shows the name of the workbook but i also need to link the cell to another workbook but i receive a "#value!" error.

I need to do this process for 50 files, in this 50 files i need this formula to show the name of each file inside of it, and after i need to link all the 50 file to another workbook who centralizes all the data in all the files.


thank you

Alex

Teeroy
07-28-2012, 04:26 AM
Hi Alex,

To put the worksheet name in a cell (say A1) with VBA use:


Range("a1").Value = Range("a1").Parent.Name
I'm not sure exactly what you are asking for in the second part of your question. Do you have an example that you can attach?