Thread: Sorting macro
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 Sorting macro

Range("A1").currentRegion.copy _
Destination:=Worksheets(2).Range("A1")
worksheets(2).Range("A1").CurrentRegion.Sort Key1:=Range("A1"), _
xlHeader:=Yes
with worksheets(2)
for i = cells(rows.count,1).End(xlup).row to 3 step -1
IF cells(i,1) < cells(i+1,1) then
cells(i,1).Resize(2).EntireRow.Insert
end if
Next
End With

--
Regards,
Tom Ogilvy



"Sapphire69" wrote in message
...
I have a worksheet with a large range of data. I would like to create a
macro that will read through the data, sort it out by city, and paste each
"city group" of information on a new sheet with two rows between them. I
would also like to assign that macro to a button that I can click to run

it.

Any suggestions?