Using Lookup in a macro
One way:
FInd additional help in XL/VBA Help ("List of Worksheet Functions
available to Visual Basic"):
Dim vResult As Variant
Dim sLookup As String
Dim rLookup As Range
Dim rReturn As Range
sLookup = "My Lookup Value"
Set rLookup = ActiveSheet.Range("A1:A100")
Set rReturn = ActiveSheet.Range("B1:B100")
On Error Resume Next
vResult = Application.WorksheetFunction.Lookup( _
sLookup, rLookup, rReturn)
If Err.Number < 0 Then
MsgBox "Not found"
Else
MsgBox vResult
End If
On Error GoTo 0
In article ,
"Fred Smith" wrote:
Does VBA support an Application.Lookup command, and if so, how do you pass
the
function its parameters?
|