+ Reply to Thread
Results 1 to 3 of 3

Filepath in cell problem.

  1. #1
    Registered User
    Join Date
    06-19-2007
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    72

    Filepath in cell problem.

    Hi All

    I was trying to use the following formula to return the file path of the current excel spreadsheet as part of a dynamic macro for refreshing external data.

    Please Login or Register  to view this content.
    Can anyone tell me why this formula will return the same file path in two different worksheets saved in two different locations?

    For example:

    I have a worksheet saved as 'C:\A\worksheet1.xls' and a worksheet saved as 'C:\B\worksheet2.xls'. I open them both up and insert the formula into A1 on worksheet1 and "C:\A\" appears. I then switch to worksheet2 and insert the formula into A1 and "C:\B\" appears. All appears fine until I switch back to worksheet1 and find "C:\B\" in A1...

    Also, I tried using =INFO("directory") but this seemed to be even more unstable.

    Any advice will be greatly appreciated as this makes my brain want to explode!

    Thanks
    Last edited by Gus80; 03-31-2010 at 07:37 PM.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Filepath in cell problem.

    Hi Gus,

    without a concrete cell reference, the Cell() function will show the value of the last time it was run. Start your formula with

    =SUBSTITUTE((CELL("filename",A1)),RIGHT((CEL....

    and it will reference the current file.

  3. #3
    Registered User
    Join Date
    06-19-2007
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    72

    Re: Filepath in cell problem.

    Great!

    Thankyou yet again!

+ 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