Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Vlookup a date
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Vlookup a date
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VLOOKUP with a date, from A1 = Now() | Excel Discussion (Misc queries) | |||
vlookup by date | Excel Worksheet Functions | |||
vlookup using date | Excel Discussion (Misc queries) | |||
Vlookup and Date | Excel Worksheet Functions | |||
Date VLookup | Excel Worksheet Functions |