View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Insert rows into a sorted range

assume determination is made on column A

Sub addrows()
dim lastrow as Long
Dim i as Long
lastrow = cells(rows.count,"A").End(xlup).row
for i = lastrow-1 to 1 step -1
if cells(i,"A").Value < cells(i+1,"A").Value then
rows(i+1).Insert
end if
Next
End Sub

--
Regards,
Tom Ogilvy



"FIRSTROUNDKO via OfficeKB.com" wrote:

Hi,

how do I insert rows into a sorted range, when the sort changes from one row
to the next

Thanks

Darren

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1