Thread: vlookup
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
T De Villiers[_94_] T De Villiers[_94_] is offline
external usenet poster
 
Posts: 1
Default vlookup


this is my original function, works fine,
however the lookup range can vary greatly, 2nd version is below,
not quite working, help on this one is much appreciated

Function taz(a, b) As Variant
Dim res As Variant
res = Application.VLookup(a, Range("Jobs!$A$1:$F$65000"), b, 0)

If IsError(res) Then
res = Application.VLookup(a, Range("Jobs!$A$1:$F$65000"), b, 0)
End If

If IsError(res) Then
taz = 0
Else
taz = res
End If

End Function

Version 2:

Function taz(a, b,c,d,e,f) As Variant
Dim res As Variant
res = Application.VLookup(a,
Range(Sheets("Jobs").Cells(c,d),Sheets("Jobs").Cel ls(e,f)), b, 0)

If IsError(res) Then
res = Application.VLookup(a,
Range(Sheets("Jobs").Cells(c,d),Sheets("Jobs").Cel ls(e,f)), b, 0)

End If

If IsError(res) Then
taz = 0
Else
taz = res
End If

End Function


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=567917