+ Reply to Thread
Results 1 to 4 of 4

How to prompt user for location of file to reference

  1. #1
    Registered User
    Join Date
    11-29-2010
    Location
    Nashville
    MS-Off Ver
    2010
    Posts
    76

    How to prompt user for location of file to reference

    I'm working on a tool for work that I'm trying to make as simple as possible for everyone that will use it. I would like a macro that will prompt the user for the location of the file that contains reference data to go into the tool. When the user selects the reference data file, the macro should go in and import columns R:R, U:U, and AV:AV from the reference file into columns A:A, B:B, and C:C in the tool.

    Thanks for your help. I'm extremely new to Macros, so please ask questions if I'm being unclear.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to prompt user for location of file to reference

    Try this... it will prompt for a workbook, open it and import the designated columns from the first sheet in the workbook into the workbook containing the macro.
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    11-29-2010
    Location
    Nashville
    MS-Off Ver
    2010
    Posts
    76

    Re: How to prompt user for location of file to reference

    Ok, I can manually run the macro and it will give me the option to choose a file, and then it clears out my columns A:C, but it doesn't paste new data in them.

    Also, when is this macros supposed to run? I would like it to run upon opening the document.

    Thanks for the reply, making progress...

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to prompt user for location of file to reference

    There's no code to "clear columns A:C", what's happening is it is opening the file you select and copying the designated columns into A:C and apparently those columns are empty.

    You can put this macro into the ThisWorkbook module:
    Please Login or Register  to view this content.

+ 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