If you drop the .worksheetfunction, you can use something like:
dim levBR as Variant 'could return an error
levbr = application.vlookup(dadate,range("a5:a35"),1,false)
if iserror(levbr) then
msgbox "not found"
else
msgbox "found"
end if
==
If you want to keep the .worksheetfunction, you have to trap that error:
dim levbr as date
on error resume next
levbr = application.vlookup(dadate,range("a5:a35"),1,false)
if err.number <> 0 then
msgbox "not found"
err.clear
else
msgbox "Found"
end if
on error goto 0
==========
But if I were only looking to see if it's there, I'd use application.match()
dim levBR as Variant 'could return an error
levbr = application.match(dadate,range("a5:a35"),0)
if iserror(levbr) then
msgbox "not found"
else
msgbox "found"
end if
And sometimes VBA and dates don't play nice. Sometimes this works better:
dim levBR as Variant 'could return an error
levbr = application.match(clng(dadate),range("a5:a35"),0)
if iserror(levbr) then
msgbox "not found"
else
msgbox "found"
end if
And I'd be more specific about what worksheet to look at:
levbr = application.match(clng(dadate),worksheets("sheet1").range("a5:a35"),0)
=======
And one more option...
if application.countif(worksheets("sheet1").range("a5:a35"),dadate) > 0 then
'found it
else
'not found
end if