+ Reply to Thread
Results 1 to 5 of 5

Cell containing it's workbooks' filename

  1. #1
    Forum Contributor
    Join Date
    04-13-2006
    Location
    London
    Posts
    102

    Cell containing it's workbooks' filename

    Can a cell contain the filename of its workbook?

    IE: If workbook's filename is "My Spreadsheet.xls", can cell A1 contain a formula so that it displays this in the cell?

    Thanks,

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    For any of these to work the workbook must be saved first

    =CELL("filename",A1) - Full file path, including worksheet name

    =LEFT(CELL("filename",A1), FIND("]",CELL("filename", A1))) - Full file path

    =LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1)) - 2) - Path only

    =MID(LEFT(CELL("filename",A1), FIND("]", CELL("filename", A1))- 1), FIND("[",CELL("filename", A1))+1, 255) - File name only

    =MID(CELL("filename",A1), FIND("]", CELL("filename", A1))+ 1, 255) - Worksheet name only
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    12-18-2006
    Posts
    46
    Not sure if a formula can do it, but with VBA it's real easy and not complicated at all.

    Edit:

    Yes it can!

  4. #4
    Forum Contributor
    Join Date
    04-13-2006
    Location
    London
    Posts
    102
    Thanks guys - I can do it in VBA, but just wondered if a formula could. And now I know - cheers!

  5. #5
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Glad you got it sorted out - thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1