View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default insert blank line at change of year

Assume first date is in A2; dates in column A.

lastrow = cells(rows.count,1).End(xlup).Row
for i = lastrow to 3 Step -1
if Year(cells(i,1)) < Year(cells(i-1,1)) then
rows(i).Insert
end if
Next

--
Regards,
Tom Ogilvy


"BillyRogers" wrote in message
...
I have a spreadsheet with a column of sorted dates like this

27-Feb-01
27-Feb-01
01-Feb-02
01-Feb-02
01-Feb-02

I would like a macro that can insert a row at each change of year. Does
anyone have any ideas how to do this?