View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Blondie[_3_] Blondie[_3_] is offline
external usenet poster
 
Posts: 1
Default Help with Vlookup a date

Wonderful - as always "You are the man"

"Tom Ogilvy" wrote in message
...
that would mean it didn't find the value you are looking for.

Try it like this:

res = Application.VLookup(clng(Cdate(Textbox2)), _
Worksheets(2).Range("D:E"), 2, False)
if not iserror(res) then
msgbox res
else
msgbox "No match found for " & _
format(cdate(textbox2),"mm/dd/yyyy")
end if

--
regards,
Tom Ogilvy





"Jim" wrote:

Please help
I am trying to use the WorksheetFunction.Vlookup to find a date on a
worksheet and then display a Msgbox containing the text in the adjacent
cell.
The date is intially entered in a textbox on a userform.
The Date Column (D) is formatted as date (dd/mm/yyyy)
However I get error 1004.


The code is as follows
MsgBox Application.WorksheetFunction.VLookup(Cdate(Textbo x2),
Worksheets(2).Range("D:E"), 2, False)


Regards & TIA