Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using Built in Functions in VBA Code
Hi I need some assistance.
Can somebody show my how to use say a vlookup function in my vba code , as opposed to using it on a worksheet. I've done this before but can't remember how Something to do with application object ? Thanks in anticipation Chris |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using Built in Functions in VBA Code
I find leaving out the WorksheetFunction portion works better for me. Also,
when a #N/A would be returned if used in the worksheet (no find), if you just use Application, you can test the return value with iserror. If you use WorksheetFunction as a qualifier, you have to use Error trapping since it raises a trappable error. Dim Res As Variant Res = _ Application.VLookup(123,Range("A1:B10"),2,False) if iserror(res) then msgbox "Not found" else msgbox "Valure returned is " & res End if Regards, Tom Ogilvy "Chip Pearson" wrote in message ... Chris, Try something like Dim Res As Variant Res = Application.WorksheetFunction.VLookup(123,Range("A 1:B10"),2,False) -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Chris Parker" wrote in message om... Hi I need some assistance. Can somebody show my how to use say a vlookup function in my vba code , as opposed to using it on a worksheet. I've done this before but can't remember how Something to do with application object ? Thanks in anticipation Chris |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
New Built in Functions 2007 | Excel Worksheet Functions | |||
Viewing Built-in Code | New Users to Excel | |||
language of built-in functions | Excel Discussion (Misc queries) | |||
Can I do this with built in functions? | Excel Worksheet Functions | |||
How do I use Excel Built-In Functions in Code? | Excel Worksheet Functions |