user1968084
user1968084

Reputation: 173

Worksheet name from cell and filename functions

I am trying to get the name of each worksheet in a workbook in the A1 cell of each worksheet. I am using the following equation.

=MID(CELL("filename"),(FIND("]",CELL("filename"))+1),(LEN(CELL("filename"))-(FIND("]",CELL("filename")))))

This seems to work but once I save the file every worksheet then has name of the worksheet that was active when I save the file rather than the correct name of the worksheet. Is there a way around this or a better way to dynamically read the worksheet name? THanks.

Upvotes: 0

Views: 725

Answers (1)

Gary's Student
Gary's Student

Reputation: 96791

For each formula, replace:

CELL("filename")

with:

CELL("filename",A1)

everywhere:

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

Typically I:

  1. first save the file
  2. install the "name" formulas
  3. re-save the file

Upvotes: 1

Related Questions