Results 1 to 8 of 8

Populating an Array with worksheetfunction.vlookup results

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Populating an Array with worksheetfunction.vlookup results

    Hello there.

    I'm working on an application and have hit a snag. I have a variable defined as an array with 6 values, N(5) As String

    I am trying to populate this array with values from a single row, which I need to be matched via a Vlookup function. There are six values per row. I am getting an error stating "Unable to get the VLookup property of the WorksheetFunction class" (Run-time 1004)

    Here is the code, with the bad line highlighted;

    Dim LV As String
    Dim N(5) As String
    LV = Range("B2").Offset(i, 0).Value
    
            For x = 0 To 5
                N(x) = Application.WorksheetFunction.VLookup(LV, Range("Sheet3!A:AF"), x + 5, 0)
                    If Err.Number <> 0 Then Resume Next
            Next x
    Looking at the below website I see the formula is being declared as a variant, is this required? And if so, how would I go about modifying the code to include this?

    cpearson page for calling worksheet functions


    Thanks!
    Last edited by Speshul; 09-30-2014 at 10:19 AM.
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 13
    Last Post: 06-18-2014, 08:14 PM
  2. Vlookup/Array formula to show multiple results
    By Booms in forum Excel General
    Replies: 10
    Last Post: 09-26-2011, 12:15 AM
  3. Worksheet function Vlookup and VLOOKUP return different results
    By zandero in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-08-2010, 08:24 AM
  4. VLOOKUP results for every tab of worksheet
    By mjwillyone in forum Excel General
    Replies: 2
    Last Post: 02-14-2008, 06:10 PM
  5. Which is faster: VLOOKUP-worksheet or VB-array VLOOKUP?
    By erikhs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-06-2006, 01:25 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