View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JulieD JulieD is offline
external usenet poster
 
Posts: 618
Default Vlookup -- LookupV

Hi Ola

one way:

Function LookupV(Lookup_Value, Table_Array As Range, Col_Index_Num,
Range_value, Error_Msg)
On Error Resume Next
LookupV = Application.WorksheetFunction.VLookup(Lookup_Value ,
Table_Array, Col_Index_Num, Range_value)
If IsEmpty(LookupV) And Not IsEmpty(Error_Msg) Then
LookupV = Error_Msg
End If
End Function

Note the change from Col_Index to Col_Index_Num in the function.

Cheers
JulieD



"Ola" wrote in message
...
Hi,

How can I make this work?

Function LookupV(Lookup_Value, Table_Array As Range, Col_Index_Num,
Range_value, Error_Msg)
LookupV = Application.WorksheetFunction.VLookup(Lookup_Value ,
Table_Array, Col_Index, Range_value)
If (IsError(LookupV) And Not IsEmpty(Error_Msg)) Then
LookupV = Error_Msg
End Function

It's my first attempt to make a Function.

Ola