Link to home
Start Free TrialLog in
Avatar of newparadigmz
newparadigmzFlag for United States of America

asked on

Excel VBA, Can you use Index, Match in VBA without calling Worksheet.Function?

I need to loop through an array, do an index match for tens of thousands of records and the call to worksheet.function is extremely slow. Any way to avoid the slowness or the call altogether?

        Set rTradeId = .Range("B2:B" & lRowsEag)
        avTradeId = rTradeId.Value2
        Set rEntity = .Range("C2:C" & lRowsEag)
        rEntity.ClearContents
        avEntity = rEntity.Value2
        On Error Resume Next
            With WorksheetFunction
                For j = 1 To UBound(avEntity)
                    avEntity(j, 1) = .Index(rTableLch, .Match(avTradeId(j, 1), rShAdmin, 0), 1)
                Next j
            End With
        On Error GoTo 0
        rEntity.Value2 = avEntity
SOLUTION
Avatar of leonstryker
leonstryker
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of newparadigmz

ASKER

That's a bummer, Autofill is faster, but still pretty slow.

Thanks