Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLOOKUP with a date, from A1 = Now() Dale G[_2_] Excel Discussion (Misc queries) 3 December 11th 09 01:45 PM
vlookup by date PointerMan Excel Worksheet Functions 10 February 9th 09 07:54 AM
vlookup using date little bear Excel Discussion (Misc queries) 5 July 29th 06 11:58 PM
Vlookup and Date Ted Metro Excel Worksheet Functions 5 December 8th 04 09:37 PM
Date VLookup Court Excel Worksheet Functions 1 November 11th 04 04:01 PM


All times are GMT +1. The time now is 03:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"