Formatting my column? PLEASE HELP

C

cjandc

I have an excel worksheet with 64000+ records. These records need to b
grouped together by document ID in column A. Right now they are al
smashed together and I wanted to know if I could use VBA to format thi
first column so that it compares the document ID numbers and inserts
rows when there is a change in document ID to separate the new documen
ID number from the previous ones
 
J

J.E. McGimpsey

Sure, as long as you don't have more than about 500 different
document IDs (otherwise you'll run out of rows):

Public Sub Insert3()
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(3, 1).EntireRow.Insert
Next i
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
End With
End Sub
 

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