+ Reply to Thread
Results 1 to 8 of 8

VBA - User Prompted to choose source file for Vlookup, Error after file is opened

  1. #1
    Registered User
    Join Date
    03-07-2016
    Location
    LA
    MS-Off Ver
    2015
    Posts
    4

    VBA - User Prompted to choose source file for Vlookup, Error after file is opened

    This macro is just a vlookup. It is supposed to run column A in SITELIST_MACRO against column A in the file the user is prompted to open. Running into an error at the vLookup line. "application-defined or object-defined error"
    I am currently at the following code:
    Please Login or Register  to view this content.
    Last edited by alansidman; 03-07-2016 at 09:06 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2407 Win 11 Home 64 Bit
    Posts
    24,077

    Re: VBA - User Prompted to choose source file for Vlookup, Error after file is opened

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA - User Prompted to choose source file for Vlookup, Error after file is opened

    You need to incorporate myFileNamein the formula.
    Please Login or Register  to view this content.
    By the way, what is the code actually meant to do?

    I'm asking because you open a file, add a load of formulas to a sheet on the file and then close the file without saving.

    Also, there's only one column in the lookup range so the vlookup isn't really going to do much.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    03-07-2016
    Location
    LA
    MS-Off Ver
    2015
    Posts
    4

    Re: VBA - User Prompted to choose source file for Vlookup, Error after file is opened

    Thanks for your help!

    Need to run a vlookup, function inserted into Column C2.
    Lookup Value A:A in Macro sheet, and then table array A:A in file the user is prompted to open, col_index 1...

    Any ideas?

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA - User Prompted to choose source file for Vlookup, Error after file is opened

    If the lookup range is only one column then the VLOOKUP will just return the value you are looking up.

  6. #6
    Registered User
    Join Date
    03-07-2016
    Location
    LA
    MS-Off Ver
    2015
    Posts
    4

    Re: VBA - User Prompted to choose source file for Vlookup, Error after file is opened

    Quote Originally Posted by Norie View Post
    If the lookup range is only one column then the VLOOKUP will just return the value you are looking up.
    Yes, this is the objective!

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA - User Prompted to choose source file for Vlookup, Error after file is opened

    If you want to just find if a match is found use MATCH.

  8. #8
    Registered User
    Join Date
    03-07-2016
    Location
    LA
    MS-Off Ver
    2015
    Posts
    4

    Re: VBA - User Prompted to choose source file for Vlookup, Error after file is opened

    Quote Originally Posted by Norie View Post
    If you want to just find if a match is found use MATCH.
    Can you expand on this further? Not familiar with that function. Would that be simpler to execute in my example?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 01-16-2013, 03:10 PM
  2. Splash screen in file opened by VBA hinders further processing of opened file.
    By Rod38 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2012, 09:53 AM
  3. [SOLVED] How to allow the user to choose the file when uploading a file using a Macro
    By SarahB2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2012, 03:09 PM
  4. Choose a file to merge with the opened one
    By AAreias in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2010, 06:34 AM
  5. not being prompted that user has file open
    By maryj in forum Excel General
    Replies: 0
    Last Post: 12-15-2005, 11:15 AM
  6. Replies: 0
    Last Post: 08-23-2005, 09:05 PM
  7. Replies: 0
    Last Post: 08-23-2005, 09:05 PM
  8. Replies: 0
    Last Post: 08-23-2005, 09:05 PM

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