Greetings,
I have a need to insert a blank row when cell content changes.
data begins in A2. When the cell content changes in col A, insert blank row after last item.
Col A
1234
1234
1234
2345
Row to be inserted after the last 1234. Need to structure thru list, which will vary over time
Thanks!
Insert Blank line after change in cell data
-
- 4StarLounger
- Posts: 539
- Joined: 30 Mar 2010, 18:49
- Location: United States
-
- Administrator
- Posts: 78558
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Insert Blank line after change in cell data
Run this macro:
Code: Select all
Sub InsertRows()
Dim r As Long
Dim m As Long
Application.ScreenUpdating = False
m = Range("A" & Rows.Count).End(xlUp).Row
For r = m To 3 Step -1
If Range("A" & r).Value <> Range("A" & r - 1).Value Then
Range("A" & r).EntireRow.Insert
End If
Next r
Application.ScreenUpdating = True
End Sub
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 539
- Joined: 30 Mar 2010, 18:49
- Location: United States
Re: Insert Blank line after change in cell data
Perfect! Than you....