Using Lookup in a macro
Does VBA support an Application.Lookup command, and if so, how do you pass the
function its parameters? -- Regards, Fred |
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? |
All times are GMT +1. The time now is 09:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com