+ Reply to Thread
Results 1 to 7 of 7

Cant retrieve data using VlookUp with another Workbook

Hybrid View

  1. #1
    Registered User
    Join Date
    07-01-2015
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    66

    Cant retrieve data using VlookUp with another Workbook

    I can't get my values from another workbok .
    Please help and appreciated your effort.


    Dim MaxRowNum As Integer
    
        Sheets("SimPat").Select
    
        'Counting number of rows
        MaxRowNum = 1
            
        Do While Cells(MaxRowNum, 2) <> "" Or Cells(MaxRowNum + 1, 2) <> ""
            MaxRowNum = MaxRowNum + 1
        Loop
        
        Workbooks.Open ("C:\Users\marosario\Desktop\SimpatTest\SAPUSERMASTER.xls")
        
        'Vlookup User Name and User Dept from the file SAPUSERMASTER.xls
        'Range("P3").FormulaR1C1 = "=IF(C[-3]="""","""",IFERROR(VLOOKUP(C[-3],SAPUSERMASTER.xls!R[-2]C4:R[64990]C10,7,0),""NOT INDICATED""))"
        'Range("P3").FormulaR1C1 = "=IF(C[-3]="""","""",IFERROR(VLOOKUP(C[-3],[SAPUSERMASTER.XLS]SAPUSERMASTER!("$1:$1048576"),2,0),""NOT INDICATED""))"
        
        
        'Range("Q3").FormulaR1C1 = "=IF(C[-4]="""","""",IFERROR(VLOOKUP(C[-4],SAPUSERMASTER.xls!R[-2]C4:R[64990]C16,13,0),""NOT INDICATED""))"
        Range("Q3").FormulaR1C1 = "=IF(C[-4]="""","""",IFERROR(VLOOKUP(C[-4],[SAPUSERMASTER.XLS]SAPUSERMASTER!$1:$1048576,3,0),""NOT INDICATED""))"
        
        'AutoFill formula. Copy and paste data as value
        Range("P3:Q3").Select
        Selection.AutoFill Destination:=Range("P3:Q" & MaxRowNum), Type:=xlFillDefault
        
        Columns("P:Q").Select
        Columns("P:Q").EntireColumn.AutoFit
        
        Columns("P:Q").Select
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        
        
        
        Application.CutCopyMode = False
    
        Range("P2").Select
        
    End Sub
    Last edited by fluffyvampirekitten; 07-03-2015 at 05:02 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,640

    Re: Cant retrieve data using VlookUp with another Workbook

    Please use code tags (#) instead of quotes around your code - Thx

  3. #3
    Registered User
    Join Date
    07-01-2015
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    66

    Re: Cant retrieve data using VlookUp with another Workbook

    Thanks for replying.
    Where should i put the (#) ? Can you explain why do i have to hastags instead of quotes?
    All the quotes ?

  4. #4
    Registered User
    Join Date
    07-01-2015
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    66

    Re: Cant retrieve data using VlookUp with another Workbook

    ................
    Last edited by fluffyvampirekitten; 07-03-2015 at 05:01 AM.

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,640

    Re: Cant retrieve data using VlookUp with another Workbook

    Edit your post
    Remove the
    AND
    tags
    Select your code
    Click the # button

    Edit also read " forum rules" it's all explaned there
    Last edited by Pepe Le Mokko; 07-03-2015 at 04:49 AM.

  6. #6
    Registered User
    Join Date
    07-01-2015
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    66

    Re: Cant retrieve data using VlookUp with another Workbook

    OPS! hahaha .
    I'm so sorry . Yep Changed.

    Merci Beaucoup
    Last edited by fluffyvampirekitten; 07-03-2015 at 05:02 AM.

  7. #7
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,640

    Re: Cant retrieve data using VlookUp with another Workbook

    Np, code tags make life easier for everyone

+ 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: 3
    Last Post: 05-10-2015, 12:29 AM
  2. Replies: 0
    Last Post: 05-05-2014, 11:06 AM
  3. [SOLVED] Can I retrieve lost data through vlookup?
    By big_les in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-12-2013, 04:41 AM
  4. [SOLVED] Retrieve Data from Columns in one Workbook into another Workbook
    By tanfeicici in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-05-2013, 08:37 PM
  5. Retrieve data from a closed workbook
    By Knigtandday in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2013, 06:02 PM

Tags for this Thread

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