row separation

  • Thread starter Thread starter domagoj
  • Start date Start date
D

domagoj

I have a table which consists columns "point", "x1", "y1"
There are many points one after another, and i need them separated with one
row.
Example:
point1 x1,y1
point2 x2,y2
point3 x3,y3

into this:

point1 x1,y1

point2 x2,y2

point3 x3,y3

How to insert that rows by selecting all cells that need separating?
 
Hi
try the following macro. It tests column A and inserts a blank row if
the values change
Sub insert_rows()
Dim lastrow As Long
Dim row_index As Long

lastrow = ActiveSheet.Cells(Rows.count, "A").End(xlUp).row
For row_index = lastrow - 1 To 1 Step -1
If Cells(row_index, "A").Value <> Cells(row_index + 1, "A").Value
Then
Cells(row_index + 1, "A").EntireRow.Insert (xlShiftDown)
End If
Next
End Sub
 
Back
Top