View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RW RW is offline
external usenet poster
 
Posts: 49
Default Change text to date and check against date in cell

I have the following:
qryMonth and qryYear are passed from a form.


CDt3 = ((qryMonth) & "/1/" & qryYear)
If WshD.Range("M65536").End(xlUp) CDt3 Then
....

The data in the Range is a date (also formatted as a date)
If the Range is 9/1/05 and CDt3 = 10/1/05 the If statement does not see CDt3
as being greater.

What needs to be done to CDt3 so that it works properly?
I did try:
NValue = FormatDateTime(CDt3)
and used NValue in the IF statement without success.

Thanks for any help.