I'd guess you didn't reset your error handling code correctly, too.
dim Res as variant
on error resume next
res = application.worksheetfunction.vlookup(----)
if err.number < 0 then
res = "Missing???"
err.clear
end if
on error goto 0
=========
But you can drop the .worksheetfunction portion and just check for an error:
dim res as variant
res = application.vlookup(....)
if iserror(res) then
res = "missing???"
end if
I find the application.vlookup() much easier to work with and easier to
understand.
MasterGee wrote:
Hi Simon,
Firstly, many thanks for your reply.
My OnError code just adds the value in the first spreadsheet to the
second spreadsheet - there's no Err.Clear or Resume in there, as I'm
not aware of these statements/Keywords. I'll certainly give them ago
though, as that sounds like the kind of solution I was expecting.
Never thought about using Find, as, if I do find the value, I have to
return an associated value from the second spreadsheet to the first -
hence the Vlookup. However, if Err.Clear or Resume doesn't work, I'll
give that a go.
Once again, thanks ever so much. :)
--
MasterGee
------------------------------------------------------------------------
MasterGee's Profile: http://www.excelforum.com/member.php...o&userid=26372
View this thread: http://www.excelforum.com/showthread...hreadid=396462
--
Dave Peterson