Results 1 to 3 of 3

VBA to insert Vlookup to a range of cells

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-19-2015
    Location
    Karnataka, INdia
    MS-Off Ver
    MS Office 2010
    Posts
    277

    VBA to insert Vlookup to a range of cells

    Hi Experts,

    I am trying to insert vlookup to return a range of cells in destination sheet when 4 criteria are met.

    I have merged all the referenced criteria in source sheet in Column A for easier lookup. I tried this code but could not finish

    Sub Extract_Data()
    Dim sws As Worksheet, dws As Worksheet
    Set dws = Sheets("PromOpti Tracker")
    Set sws = Sheets("Master Data")
    Dim Cri1Rng As Range
    Dim Cri2Rng As Range
    Dim Cri3Rng As Range
    Dim Cri4Rng As Range
    Dim Lstrow As Long
    With dws
    Set Criteria1 = dws.Range("$A$4")
    Set Criteria2 = dws.Range("$M$14:$M$66")
    Set Criteria3 = dws.Range("$O$14:$O$66")
    Set Criteria4 = dws.Range("$P$11:$AE$11")
    Set OutputRng = sws.Range("E2:H" & Cells(Rows.Count, "E2:H").End(xlUp).Row)
    Set Lookuprng = sws.Range("A2:A" & Cells(Rows.Count, "A2:A").End(xlUp).Row)
    dws.cells.Formula="=vlookup(Criteria1&Criteria2&Criteria3&Criteria4,sws.range("A2:H" & cells(rows.count,"A2:H").end(xlup).row),outputRng,0"
    End Sub
    Last edited by Biplab1985; 03-22-2018 at 08:12 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to insert items in column A into a range of cells and copying the range
    By arbazhamayun in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 02-06-2018, 03:44 PM
  2. Using VBA to insert a Vlookup function in range
    By mido609 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-06-2014, 01:17 PM
  3. Insert = sign into range of cells
    By blp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-25-2013, 10:59 AM
  4. If no match between two cells in same row, insert range of cells above
    By jreedy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-01-2013, 01:57 PM
  5. Replies: 3
    Last Post: 06-22-2010, 07:17 PM
  6. [SOLVED] Sum Cells or Range and Insert Value into Cell
    By Bill Ray in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2006, 01:50 AM
  7. [SOLVED] Insert Vlookup into table_array of Vlookup with named range
    By Denise in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-24-2005, 07:06 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