When sorting info in columns, can I make it insert blank line bet.

N

nanalehew

I have a spreadsheet with columns of dollar amounts. Some cells contain
duplicate information. I have sorted the column to group all duplicate
amounts together beginning with the highest dollar amount at the top. I now
want to add a blank line between each "set" of duplicate amounts. Can I do a
sort to make that happen?
 
O

Otto Moehrbach

No. You would need a macro to do that. Post back if this is what you want.
HTH Otto
 
G

Gord Dibben

I think a macro after the sort would be the easiest method.

The code below inserts a row at each change of value in column A.

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

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

First...create a backup copy of your original workbook.

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and Insert>Module. Paste the code in there. Save the
workbook and hit ALT + Q to return to your workbook.

Run the macro by going to Tool>Macro>Macros.


Gord Dibben Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top