Home |
Search |
Today's Posts |
#9
![]() |
|||
|
|||
![]()
If you want to see "Jan 2005" in the formula bar, then you can't keep it a
date. If you want to see "Jan 2005" in the cell, but 01/01/2005 in the formula bar, then keep it a date. Jan 2004 will come after Dec 2004 in a text comparison. " wrote: ei dave, is the first formula you provided : Dim DateToday As String DateToday = Format(Date, "mmm yyyy") With Selection .NumberFormat = "@" 'text .Value = DateToday End With ActiveCell.Offset(0, 1).Select just makes the value a text and i wont be able to compare it with other dates? coz that seems to be the problem coming up when i run it, i made a simple macro so i can test if it's actually comparing dates. Sub alkdfj() Dim DateToday As String DateToday = Format(Date, "mmm yyyy") With Selection .NumberFormat = "@" 'text .Value = DateToday End With ActiveCell.Value = DateToday Dim First As Date Dim Second As Date Selection.Value = DateToday DateToday = First Range("P2").Value = Second 'Value in Cell P2 = 09/09/2005 Second = Format(Date, "mmm yyyy") ActiveCell.Offset(0, 1).Select If First Second Then ActiveCell.Value = "Right" Else ActiveCell.Value = "Wrong" End If End Sub I can't get it right. and in this syntax the value on the P2 becomes "12:00:00 AM" sorry, im kinda new with this =D -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I create a schedule from a list of dates ? | Charts and Charting in Excel | |||
Round date to first of month | Excel Discussion (Misc queries) | |||
How do I copy only the month from a date | Excel Worksheet Functions | |||
Lookup the month in a date string 01/03/05 | Excel Worksheet Functions | |||
Month Year Date Format | Excel Worksheet Functions |