Thread: Date Variable
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Date Variable

The below Worksheet function will convert the number to date

=TEXT(39881,"dd-mm-yyyy")

If this post helps click Yes
---------------
Jacob Skaria


"Ranjith Kurian" wrote:

I have created the below variable to get current month and previous month

curmth = Format(Date, "mmm-yy")
prvmth = Format(DateSerial(Year(Date), Month(Date) - 1, 1), "mmm-yy")

and i have made my active cell to value2
dt = Cells(i, 4).Value2

So the active cell convert the date to values/numbers, i need to compare my
above variable with the activecell, as the format are different i am
unsucceful in this.

Could someone advise me how to change my variables(curmth and prvmth) to
values/number (example: 3/9/2009is the date and the number for that is 39881)