View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] jayj0nes@yahoo.com is offline
external usenet poster
 
Posts: 3
Default Group date into Year and Quarters

I think you need to surround your dates in VBA with the pound sign (#).
For example...

If ActiveCell = #10/1/2003# and ActiveCell <= #12/31/2003#

Also, notice my date format is m/d/yyyy where yours is d/m/yyyy. Excel
forces me to use m/d/yyyy format, but this may be due to my system's
date settings.

good luck!


Here is my code, however it sorts it just into 2004 Q1 or 2003 Q4.


If ActiveCell = "01/10/2003" And ActiveCell <= "31/12/2003"
Then
ActiveCell.FormulaR1C1 = "2003 Q4"

' 2004

ElseIf ActiveCell = "01/01/2004" And ActiveCell <=
"31/03/2004" Then
ActiveCell.FormulaR1C1 = "2004 Q1"