Excel

Speed Up Vlookup

Ease of Use

Easy

Version tested with

2007 

Submitted by:

CatDaddy

Description:

faster and more reliable than Evaluate 

Discussion:

 

Code:

instructions for use

			

Private Function Looker(ByVal lRng As String, ByVal sht As String, ByVal sRng As String, ByVal c As Integer) As String Dim var As Variant On Error Resume Next var = Application.WorksheetFunction.VLookup(Range(lRng), Sheets(sht).Range(sRng), c, 0) If IsError(var) Then Looker = "" Else Looker = CStr(var) End If End Function

How to use:

  1. Call Looker from code:
  2. someRange.Value = Looker("A1","Sheet2","A2:B40",2)
 

Test the code:

 

Sample File:

No Attachment 

Approved by Jacob Hilderbrand


This entry has been viewed 32 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express