Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with Custom Function


Hi,
I know very little about VBA....I am trying to create a user define
function. I use the following formula all the time and wanted to sav
it as a function to save time....
=IF(ISERROR(VLOOKUP(LOOKUP_VALUE,TABLE_ARRAY,COL_I NDEX_NUM,RANGE_LOOKUP),0,VLOOKUP(LOOKUP_VALUE,TABL E_ARRAY,COL_INDEX_NUM,RANGE_LOOKUP)

I inserted a new module in VBA to create the function and worte th
following( I am sure I am way off)......

Function Noerorvlookup(Lookup, Range, Column)
Noerrorvlookup
IF(ISERROR(VLOOKUP,Lookup,Range,Column,False),0,VL OOKUP,Lookup,Range,Column,False))
End Function

Can anyone help fix my horrible code?

Thanks!

--
Flamike
-----------------------------------------------------------------------
Flamikey's Profile: http://www.excelforum.com/member.php...nfo&userid=461
View this thread: http://www.excelforum.com/showthread.php?threadid=27740

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help with Custom Function

Function Noerorvlookup(Lookup As Variant, Rng As Range, Col As Long)
Dim res as Variant
res = Application.VLookup(Lookup, Rng, Col, False)
If IsError(res) Then
Noerorvlookup = 0
Else
Noerorvlookup = res
End If
End Function

--
Regards,
Tom Ogilvy

"Flamikey" wrote in message
...

Hi,
I know very little about VBA....I am trying to create a user defined
function. I use the following formula all the time and wanted to save
it as a function to save time....

=IF(ISERROR(VLOOKUP(LOOKUP_VALUE,TABLE_ARRAY,COL_I NDEX_NUM,RANGE_LOOKUP),0,V
LOOKUP(LOOKUP_VALUE,TABLE_ARRAY,COL_INDEX_NUM,RANG E_LOOKUP)

I inserted a new module in VBA to create the function and worte the
following( I am sure I am way off)......

Function Noerorvlookup(Lookup, Range, Column)
Noerrorvlookup =

IF(ISERROR(VLOOKUP,Lookup,Range,Column,False),0,VL OOKUP,Lookup,Range,Column,
False))
End Function

Can anyone help fix my horrible code?

Thanks!!


--
Flamikey
------------------------------------------------------------------------
Flamikey's Profile:

http://www.excelforum.com/member.php...fo&userid=4612
View this thread: http://www.excelforum.com/showthread...hreadid=277409



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
Custom or VBA Function for Avg, Std, Min, Max ExcelMonkey Excel Discussion (Misc queries) 1 July 17th 06 01:26 PM
Custom function Christina L. Excel Worksheet Functions 1 May 10th 06 06:38 PM
Emulate Index/Match combo function w/ VBA custom function Spencer Hutton Excel Worksheet Functions 2 May 2nd 05 05:26 PM
Particular custom function. y Excel Programming 3 April 7th 04 09:25 AM
Adding a custom function to the default excel function list DonutDel Excel Programming 3 November 21st 03 03:41 PM


All times are GMT +1. The time now is 01:54 PM.

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

About Us

"It's about Microsoft Excel"