mictlantecuhtli
New Member
- Joined
- Oct 25, 2021
- Messages
- 10
- Office Version
- 365
- Platform
- Windows
Hi guys I need to insert two rows after a row with some content like this:
To this:
I haved found this code:
The code works great inserting only one row, but need to insert two rows.
Thank's in advanced
Grettings from México
To this:
I haved found this code:
VBA Code:
Sub InsertRows()
Dim Rw As Long
Dim Rng As Range
Set Rng = Sheets(1).Range("A4")
Rw = Rng.Row
Do
If Sheets(1).Cells(Rw + 1, 1) <> Sheets(1).Cells(Rw, 1) Then
Sheets(1).Cells(Rw + 1, 1).EntireRow.Insert
Rw = Rw + 2
Else
Rw = Rw + 1
End If
Loop While Not Sheets(1).Cells(Rw, 1) = vbNullString
End Sub
The code works great inserting only one row, but need to insert two rows.
Thank's in advanced
Grettings from México