Results 1 to 8 of 8

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

Threaded View

  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:
    Sub vlookup_only() 
     ' vlookup_only Macro ' 
    ' Keyboard Shortcut: Ctrl+Shift+V 
    ' Dim myFileName, SITELIST_Macro As Workbook
    myFileName = Application.GetOpenFilename
    
    If myFileName <> False Then
    
    With Range("A:A")
    
    Set wbLookupBook = Workbooks.Open(myFileName)
    
    ActiveCell.FormulaR1C1 = "=VLOOKUP(C[-2],[ myFileName.Name]Sites!C1,1,FALSE)"
    Range("C2").Select
    Selection.AutoFill Destination:=Range("C2:C10000")
    Range("C2:C10000").Select
    
    End With
    
    wbLookupBook.Close False
    
    End If
    End Sub
    Last edited by alansidman; 03-07-2016 at 09:06 PM.

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