LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Dave Peterson
 
Posts: n/a
Default

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
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
How do I create a schedule from a list of dates ? Gavin Morris Charts and Charting in Excel 2 October 28th 10 04:08 PM
Round date to first of month Dominic Excel Discussion (Misc queries) 3 July 14th 05 11:21 PM
How do I copy only the month from a date CCW Excel Worksheet Functions 2 April 15th 05 02:26 AM
Lookup the month in a date string 01/03/05 Una Excel Worksheet Functions 1 March 30th 05 09:45 AM
Month Year Date Format Jamie Excel Worksheet Functions 2 February 7th 05 06:43 PM


All times are GMT +1. The time now is 03:20 AM.

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

About Us

"It's about Microsoft Excel"