Comparing old date to now() and writing out text message in column
try this. Of course, modify to suit. Assumes dates in col A
Sub comparedate()
For Each c In Range("a1:a3")
If c + 365 Now Then c.Offset(, 1) = "Long"
If c + 365 < Now Then c.Offset(, 1) = "Short"
Next
End Sub
"Joeyej" wrote in message
om...
I'm new to Excel programming & I'm working on a [stock purchase]
spreadsheet trying to compare a column of dates (range named
"acquired") to the current date. Any acquired date over 365 days
should write a text message saying "long" in the adjacent column range
named "holding". Acquired dates less that 365 needs to write "short".
Thanks for your help.
Joe
|