Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / September 2006

Tip: Looking for answers? Try searching our database.

Grouping rows based on like data in a cell and then separating them

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nebuul@gmail.com - 27 Sep 2006 21:42 GMT
Lets say you have a 15,000 line spreadsheet covering about 8,000
different items.  Some items have multiple lines devoted to them.  Each
line is a separate transaction related to that item.

After sorting the list by the item name, I now wish to have excel
insert a blank line between each different name.  So basically this:

alpha
alpha
beta
beta
beta
gamma
delta
delta

would become this:

alpha
alpha

beta
beta
beta

gamma

delta
delta

Is there any way to do that other than manually inserting rows?  An
automated process would save a LOT of time.
Gord Dibben - 27 Sep 2006 22:32 GMT
Sub InsertRow_At_Change()
Dim i As Long
   With Application
       .Calculation = xlManual
       .ScreenUpdating = False
   End With
   For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
       If Cells(i - 1, 1) <> Cells(i, 1) Then _
               Cells(i, 1).Resize(1, 1).EntireRow.Insert
   Next i
   With Application
       .Calculation = xlAutomatic
       .ScreenUpdating = True
   End With
End Sub

Gord Dibben  MS Excel MVP

>Lets say you have a 15,000 line spreadsheet covering about 8,000
>different items.  Some items have multiple lines devoted to them.  Each
[quoted text clipped - 28 lines]
>Is there any way to do that other than manually inserting rows?  An
>automated process would save a LOT of time.

Gord Dibben  MS Excel MVP
nebuul@gmail.com - 27 Sep 2006 22:57 GMT
Awesome, thanks!

> Sub InsertRow_At_Change()
> Dim i As Long
[quoted text clipped - 48 lines]
>
> Gord Dibben  MS Excel MVP

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.