Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Sorting macro

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting in a macro Don Wiss Excel Programming 9 January 13th 05 03:39 AM
Sorting macro Simon[_8_] Excel Programming 1 October 14th 03 02:28 PM
Macro for Sorting SiRCYRO Excel Programming 0 September 9th 03 07:35 PM
Sorting with a macro? gschimek Excel Programming 2 August 29th 03 09:57 PM
Sorting w/Macro Joe[_24_] Excel Programming 1 August 28th 03 07:44 PM


All times are GMT +1. The time now is 08:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"