Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 623
Default 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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default 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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro Lookup DamienO Excel Worksheet Functions 3 October 23rd 09 09:44 AM
Run Lookup only once - Macro RachuChavan Excel Discussion (Misc queries) 1 June 12th 09 09:53 AM
lookup macro BMI Excel Discussion (Misc queries) 0 February 18th 08 03:10 PM
lookup macro?? darkbearpooh1 Excel Worksheet Functions 9 February 22nd 06 05:56 AM
Lookup macro? John Keturi Excel Programming 1 October 14th 04 06:30 AM


All times are GMT +1. The time now is 05:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"