View Single Post
  #16   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Handling Dates in VLookup

No there are problems with dates, we all know that. It is just a matter of
knowing what works and what doesn't, and using that. If you look at my
original response, I didn't use the .Value, do you think that was
coincidental? And .Value2 works, as Dave suggested.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"abcd" wrote in message
...
MsgBox Range("A1").Value = TimeSerial(1, 40, 0)
is still false and it's better to know that fact


and if you try your example with a date:

Sub test()
Range("A1").Value = DateSerial(2001, 12, 1)
Range("B1").Value = DateSerial(2001, 12, 1)
[C2] = Application.VLookup(Range("A1").Value, Range("B1:C1"), 2, False)
[C3] = Application.VLookup(Range("A1"), Range("B1:C1"), 2, False)
End Sub

you have a problem with the .value but no problem without it


I can not be sure of the reason, but whatever you should admit dates are
not so easy to be manipulated: so i am ok to have an other explanation
if you think mine is wrong, but i will not accept the idea this .value
change nothing, because it does...