Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change text to date and check against date in cell
How about using Cdate function like
If WshD.Range("M65536").End(xlUp) Cdate(CDt3) Then keizi "RW" wrote in message ... 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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change text to date and check against date in cell
You could try something like this; CDt3 = DateSerial( qryYear, qryMonth, 1 ) If ( DateDiff( "d", CDt3, WshD.Range("M65536").End(xlUp) ) 0 ) Then -- fazstp ------------------------------------------------------------------------ fazstp's Profile: http://www.excelforum.com/member.php...o&userid=30574 View this thread: http://www.excelforum.com/showthread...hreadid=507486 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change text to date and check against date in cell
kounoike and fazstp,
Thanks for helping. Both options work! "fazstp" wrote: You could try something like this; CDt3 = DateSerial( qryYear, qryMonth, 1 ) If ( DateDiff( "d", CDt3, WshD.Range("M65536").End(xlUp) ) 0 ) Then -- fazstp ------------------------------------------------------------------------ fazstp's Profile: http://www.excelforum.com/member.php...o&userid=30574 View this thread: http://www.excelforum.com/showthread...hreadid=507486 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2003 make 1 date cell automatically change another date cell | Excel Worksheet Functions | |||
CHANGE TEXT DATE TO NUMERIC DATE | Excel Worksheet Functions | |||
date in Cell to change colors if the date is beyond today's date | Excel Discussion (Misc queries) | |||
how do i change text format date to date (i.e., mm/yy to mm/dd/yyy | Excel Discussion (Misc queries) | |||
Change a date in text format xx.xx.20xx to a recognised date format | Excel Programming |