+ Reply to Thread
Results 1 to 10 of 10

open file specified in a Cell location

  1. #1
    Registered User
    Join Date
    04-08-2012
    Location
    Kansas, U.S
    MS-Off Ver
    Excel 2010
    Posts
    95

    open file specified in a Cell location

    Hello All,

    Anyone tell me how to have the coding below open a specified file using the file location specified in a cell.

    Please Login or Register  to view this content.
    Thanks
    Aeneren

  2. #2
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: open file specified in a Cell location

    You'll need the entire path in the cell unless you can get the folder information from another source. So, if C6 = C:\Users\Brian\Desktop\Excell test folder\1903\4-29-2012-1903-Brian.xlsm....

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-08-2012
    Location
    Kansas, U.S
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: open file specified in a Cell location

    Hello,

    --swoop99 thanks for your reply,
    place your code in and now am getting:
    Run-time error '9'
    Subscript out of range
    Also the code is now copying the Formula from the sheet's instead of the results any idea.


    Please Login or Register  to view this content.
    Thanks
    Aeneren
    Last edited by Aeneren; 04-29-2012 at 07:52 PM.

  4. #4
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: open file specified in a Cell location

    See this page: http://www.ozgrid.com/VBA/SpeedingUpVBACode.htm for advice on using something other than copy and paste (besides having more control, it's faster to avoid use of the clipboard).

    Also, the reason it's bombing out is cos you have rem'd out the line that switches back to the workbook you just opened, therefore when you try to select sheet "Portable Suction" it can't find it. Is the name of the worksheet you open from C6 always the same length? If so, you can use something like:

    Please Login or Register  to view this content.
    If the filename varies in length then you'll have to parse it for slashes to extrapolate the workbook name to switch to.

  5. #5
    Registered User
    Join Date
    04-08-2012
    Location
    Kansas, U.S
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: open file specified in a Cell location

    Hello all,

    --swoop99
    Sorry for the confusion, ive been busy at work, and its taken this long to get back to you.
    The below was how i first targeted the file before your Cell Target code.

    Please Login or Register  to view this content.
    And this bit was how i activated it between sections, with the copy and paste
    Please Login or Register  to view this content.
    This is the code as it is now that im working with.

    Please Login or Register  to view this content.
    And it still Debugs to the begining of the Second section, looked at the link you gave and gonna try some it.
    If your up to it please feel free to give me any pointers.

    Thanks
    Aeneren

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: open file specified in a Cell location

    Hi Aeneren.Try it
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-08-2012
    Location
    Kansas, U.S
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: open file specified in a Cell location

    Hello Nilem

    Thank You Works great in the test books.
    One more tweak please, the code is pasting the Formulas instead of the data

    Aeneren

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: open file specified in a Cell location

    You only need the values? Try
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-08-2012
    Location
    Kansas, U.S
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: open file specified in a Cell location

    Hello nilem,

    Bow, Bow, Bow, Bow, Bow, Bow, Bow

    Thank You My Friend now to place this in the full workbook of over 30+ sheets



    Aeneren

  10. #10
    Registered User
    Join Date
    04-08-2012
    Location
    Kansas, U.S
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: open file specified in a Cell location

    Hello again,

    --Nilem (or anyone who can please)
    I've been trying to attach your code to the entire WB and have been having trouble trying to understand some of the code, could you possibly go line by line and Define what each line is doing for me.

    Its probally something simple but this Novice is still learning

    So i could posiblly track down why i have been getting a error of
    Not Defined Page
    Now i did have to move pages around and have been adding several more pages and fields to copy paste.

    Please Login or Register  to view this content.
    Above is the code i am using and have started to modify.


    Thanks
    Aeneren

+ 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