I have a file where column A has values in varying number of rows - for example:
City Name (Header on row 6)
- Chicago (has 14 rows with this value)
- New York (has 6 rows with this value)
- Atlanta (has 25 rows with this value)
etc.
I want to insert 2 blank rows at each change in value.
And then, on the 1st blank row that was added after each value, how can I Count the number of rows that have that value and show the results in that cell?
Currently, I'm using the following macro to insert 1 row after each change in value, but don't know how to adjust the macro - or find a better one to use.
Dim iRow As Integer, iCol As Integer
Dim oRng As Range
Set oRng = Range("a7")
iRow = oRng.Row
iCol = oRng.Column
Do
If Cells(iRow + 1, iCol) <> Cells(iRow, iCol) Then
Cells(iRow + 1, iCol).EntireRow.Insert Shift:=xlDown
iRow = iRow + 2
Else
iRow = iRow + 1
End If
Loop While Not Cells(iRow, iCol).Text = ""
City Name (Header on row 6)
- Chicago (has 14 rows with this value)
- New York (has 6 rows with this value)
- Atlanta (has 25 rows with this value)
etc.
I want to insert 2 blank rows at each change in value.
And then, on the 1st blank row that was added after each value, how can I Count the number of rows that have that value and show the results in that cell?
Currently, I'm using the following macro to insert 1 row after each change in value, but don't know how to adjust the macro - or find a better one to use.
Dim iRow As Integer, iCol As Integer
Dim oRng As Range
Set oRng = Range("a7")
iRow = oRng.Row
iCol = oRng.Column
Do
If Cells(iRow + 1, iCol) <> Cells(iRow, iCol) Then
Cells(iRow + 1, iCol).EntireRow.Insert Shift:=xlDown
iRow = iRow + 2
Else
iRow = iRow + 1
End If
Loop While Not Cells(iRow, iCol).Text = ""