If / True

D

Dan Van

I posted this yesterday, but I don't see it coming across in my Outlook
Express. Not sure why.
************************************************************************

I have the following statement and
I need to perform a function if a match is found, if no match, leave the
cell alone

RS = Application.Lookup(Range("81!F" & Z), Range("LOOKUP81!$A$1:$A$3"),
Range("LOOKUP81!$B$1:$B$3"))

if RS is true **************** Need the syntax
range("81!F" & z).value = RS
else
range("81!F" & z).value = range("81!F" & z)
end if

Thanks in advance
 
C

Chip Pearson

Dan,

If the LOOKUP function failed to find a match, it will return a
#NA error value to RS, so you can use IsError to test RS. For
example,

If IsError(RS) = False Then
' lookup found a match
Else
' lookup failed
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Top