T
T De Villiers
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").Cells(e,f)), b, 0)
If IsError(res) Then
res = Application.VLookup(a,
Range(Sheets("Jobs").Cells(c,d),Sheets("Jobs").Cells(e,f)), b, 0)
End If
If IsError(res) Then
taz = 0
Else
taz = res
End If
End Function
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").Cells(e,f)), b, 0)
If IsError(res) Then
res = Application.VLookup(a,
Range(Sheets("Jobs").Cells(c,d),Sheets("Jobs").Cells(e,f)), b, 0)
End If
If IsError(res) Then
taz = 0
Else
taz = res
End If
End Function