Results 1 to 18 of 18

Using arrays with application.vlookup still taking time

Threaded View

Ranmandaman Using arrays with... 06-12-2013, 06:45 AM
zbor Re: Using arrays with... 06-12-2013, 06:46 AM
nilem Re: Using arrays with... 06-12-2013, 07:36 AM
Ranmandaman Re: Using arrays with... 06-12-2013, 08:44 AM
nilem Re: Using arrays with... 06-12-2013, 08:56 AM
Ranmandaman Re: Using arrays with... 06-17-2013, 05:34 AM
nilem Re: Using arrays with... 06-17-2013, 06:35 AM
Ranmandaman Re: Using arrays with... 06-17-2013, 09:10 AM
Ranmandaman Re: Using arrays with... 06-17-2013, 06:36 AM
nilem Re: Using arrays with... 06-17-2013, 09:48 AM
Ranmandaman Re: Using arrays with... 07-02-2013, 04:54 PM
nilem Re: Using arrays with... 07-02-2013, 05:21 PM
Ranmandaman Re: Using arrays with... 07-02-2013, 06:15 PM
heggy Re: Using arrays with... 07-03-2013, 03:02 PM
Ranmandaman Re: Using arrays with... 07-04-2013, 12:15 PM
Ranmandaman Re: Using arrays with... 07-17-2013, 05:14 AM
nilem Re: Using arrays with... 07-17-2013, 06:47 AM
Ranmandaman Re: Using arrays with... 07-22-2013, 11:43 AM
  1. #1
    Registered User
    Join Date
    06-11-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    15

    Using arrays with application.vlookup still taking time

    Hi All

    I'm new to the forum and hoping to get some help please.

    I've got the following code in VBA which I thought would save me alot of time when doing vlookups as it is all being stored in an array. But it still takes A LONG time to run through. Am I doing something wrong here?

    Option Explicit 
    Option Base 1 
    
    Sub TestArray() 
    
    Dim Data As Variant 
    Dim Lookup As Variant 
    Dim i As Integer 
    
    
    Data = Sheets(3).Range("A2:C65536") 
    Lookup = Sheets(1).Range("J2:J3556") 
    
    ReDim Preserve Lookup(UBound(Lookup), 2)
    
    For i = 1 To UBound(Lookup) 
        Lookup(i, 2) = Application.VLookup(Lookup(i, 1), Data, 3, 0) 
        If IsError(Lookup(i, 2)) Then Lookup(i, 2) = "" 
        
        Application.StatusBar = Format((i / UBound(Lookup)) * 100, "0.00") & "%" 
    Next i 
    
        Application.StatusBar = False 
        
    With Sheets(1) 
        .Range(.Cells(2, 34), .Cells(UBound(Lookup), 34)) = Application.Index(Lookup, , 2) 
    End With 
    
    'Cells.SpecialCells(xlCellTypeConstants, 16).ClearContents 'remove N/A errors 
    
    End Sub
    Thanks
    Last edited by Ranmandaman; 06-12-2013 at 06:54 AM. Reason: Added code tags - sorry!

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