Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
From the below code iam trying to compare my active cell with previous date
, if the active cell is less than previous month then the result need to be Yes, else No. The problem iam facing from the below code in variable mmyy, when i run macro this variable is shown as Text inspite of Date because of which its not able to compare with previous date. Example: my date column is copied from MSAccess so the date is in exact this formate SEP-08 sub test() PrvMth = Format(DateSerial(Year(Date), Month(Date) - 1, 1), "mmyy") ActiveCell.Offset(1, 0).Select a = ActiveCell m = DatePart("m", a) If (m < 10) Then m = 0 & m End If y = Right(a, 2) mmyy = m & y MsgBox mmyy & vbLf & PrvMth If mmyy < PrvMth Then ActiveCell.Offset(0, 1) = "Yes" Else ActiveCell.Offset(-1, 0).Select End If End If End If End sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I convert US date with 12hr format to European date 24hr | Excel Discussion (Misc queries) | |||
Is it possible to convert solar date to lunar date using excel? | Excel Discussion (Misc queries) | |||
How to convert Gregorian date into Hijri Date in Excel 2007? | Excel Discussion (Misc queries) | |||
How do you convert an uncoded date (e.g., 20080304) to a date form | Excel Worksheet Functions | |||
Convert a julian gregorian date code into a regular date | Excel Worksheet Functions |