+ Reply to Thread
Results 1 to 3 of 3

VBA Application Vlookup

Hybrid View

  1. #1
    Registered User
    Join Date
    11-26-2018
    Location
    London, UK
    MS-Off Ver
    Office 2010
    Posts
    24

    VBA Application Vlookup

    Good Morning,

    Please can someone offer some advice.

    I have the following line of VBA code


    Range("F2:J2") = Application.Evaluate("VLOOKUP(E2, 'Sheet2'!$A$1:$K$1000,{2,3,4,8,7},FALSE)")


    This code does what I require; getting values from Sheet 2 when a particular code is input to cell E2 on sheet 1 (and making text rather than formula in the cells in sheet 1). So when code in input in E2, then automatically values on F2, G2, H2, I2, J2 are populated with information from sheet 2.


    But i'm not sure how to 'copy' this formula down to say "F3:J3", "F4:J4", etc all the way down to perhaps "F200:J200"


    Can anyone help me. I hope my post makes sense to you.


    Thanks for considering this post.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,033

    Re: VBA Application Vlookup

    Try code like
    Sub TestMacro()
        Dim lngR As Long
        For lngR = 2 To 200
            With Cells(lngR, "F").Resize(1, 5)
                .FormulaArray = "=VLOOKUP(E" & lngR & ", 'Sheet2'!$A$1:$K$1000,{2,3,4,8,7},FALSE)"
                .Value = .Value
            End With
        Next lngR
    End Sub
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    11-26-2018
    Location
    London, UK
    MS-Off Ver
    Office 2010
    Posts
    24

    Re: VBA Application Vlookup

    Thank you. This works so thank you for you help (sorry I could not respond sooner to you). Good day.

+ 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. [SOLVED] application vlookup error runtime error 1004, unable to get the vlookup property of the.."
    By dmcgov in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 12-05-2018, 12:03 PM
  2. [SOLVED] how to use application.worksheetfunction.vlookup
    By dmcgov in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-15-2017, 08:30 AM
  3. [SOLVED] Application.vlookup not working
    By forrestgump1980 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-17-2016, 09:10 AM
  4. Vlookup with application.worksheetfunction in vba
    By jeroenft in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-10-2016, 11:38 AM
  5. Application.WorksheetFunction.VLookup
    By Perfexia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-12-2014, 10:49 AM
  6. application.vlookup
    By ImboJones in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-20-2010, 10:30 AM
  7. [SOLVED] Application.Calculate & VLOOKUP
    By BHARATH RAJAMANI in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-14-2005, 09:06 AM

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