Results 1 to 16 of 16

VBA Arrays - Faster alternative than Vlookup?

Threaded View

  1. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA Arrays - Faster alternative than Vlookup?

    Worksheet function calculates faster in the range.
    If you explain more about what you are really trying to do, there may be a faster way.
    e.g
    Sub test()
        Dim a, x, s As Double, msg As String
        With Range("a1:a65535").Resize(, 2)
            .Formula = "=row()&char(column()+64)"
            s = Timer
            x = WorksheetFunction.VLookup("50000A", .Cells, 2, 0)
            msg = "Range:" & vbTab & Format$(Timer - s, "0.0000")
            s = Timer
            a = .Value
            x = WorksheetFunction.VLookup("50000A", a, 2, 0)
            MsgBox msg & vbLf & "Array:" & vbTab & Format$(Timer - s, "0.0000")
        End With
    End Sub
    Last edited by jindon; 08-21-2012 at 08:43 PM. Reason: Row size must be less than 65536 to calculate in array

Thread Information

Users Browsing this Thread

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

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