Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Custom or VBA Function for Avg, Std, Min, Max | Excel Discussion (Misc queries) | |||
Custom function | Excel Worksheet Functions | |||
Emulate Index/Match combo function w/ VBA custom function | Excel Worksheet Functions | |||
Particular custom function. | Excel Programming | |||
Adding a custom function to the default excel function list | Excel Programming |