+ Reply to Thread
Results 1 to 3 of 3

Nested Vlookups?

Hybrid View

  1. #1
    Registered User
    Join Date
    03-15-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    25

    Nested Vlookups?

    I was trying to "nest" some vlookup functions so that i could check for a value in multiple worksheets but after writing the code i realized that it returns N/A, when i would have expected it to move to the next vlookup. I understand why it does this (because once its pasted in the cell it doesnt know what the functions are) but i dont know how to correct it. I would prefer to not even past the formula in the cell but that is beyond my ability. Here is the code:

    Sub CompareLists()
        CompCore
    End Sub
    
    
    Public Function CompCore()
        MaxRowNumber = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
        AutoFillRange = "G1:G" & MaxRowNumber
        Range("G1").Select
        ActiveCell.FormulaR1C1 = _
            "=IF(ISERROR(VLOOKUP(R[0]C[-6], [Multi_Record_Macro.xlsm]Core!R1C1:R500C1, 1, FALSE)), CompReplace, ""CORE"")"
        Range("G1").Select
        Selection.AutoFill Destination:=Range(AutoFillRange), Type:=xlFillDefault
    End Function
    
    Public Function CompReplace()
        MaxRowNumber = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
        AutoFillRange = "G1:G" & MaxRowNumber
        Range("G1").Select
        ActiveCell.FormulaR1C1 = _
            "=IF(ISERROR(VLOOKUP(R[0]C[-6], [Multi_Record_Macro.xlsm]Replace!R1C1:R500C1, 1, FALSE)), CompNoInstall, ""REPLACE"")"
        Range("G1").Select
        Selection.AutoFill Destination:=Range(AutoFillRange), Type:=xlFillDefault
    End Function
    
    Public Function CompNoInstall()
        MaxRowNumber = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
        AutoFillRange = "G1:G" & MaxRowNumber
        Range("G1").Select
        ActiveCell.FormulaR1C1 = _
            "=IF(ISERROR(VLOOKUP(R[0]C[-6], [Multi_Record_Macro.xlsm]NoInstall!R1C1:R500C1, 1, FALSE)), ""QUESTION"", ""REMOVE"")"
        Range("G1").Select
        Selection.AutoFill Destination:=Range(AutoFillRange), Type:=xlFillDefault
    End Function

  2. #2
    Registered User
    Join Date
    03-15-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Nested Vlookups?

    I have 2 posts and i haven't gotten a response for either. I don't mean to be impatient. I just want to make sure I haven't done anything wrong to cause people to avoid helping me. These are my first posts. If anyone could kindly point me in the right direction I would appreciate the help. Thanks

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Nested Vlookups?

    It will be good if you attach a sample file and explain what data you need to lookup.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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