I recently found a thread with the same name (http://www.mrexcel.com/forum/showthread.php?t=420750), and two people had posted codes which were said to insert rows between sequence gaps, i.e. making 1,2,4,5 : 1,2,3,4,5 in column b (for example), but when I have tried using the codes, neither actually do anything to the active sheet. anyone know why this may be?
Code 1: Zack Barresse
Code 2: Texasalynn
(both formatted properly in in other thread)
Code 1: Zack Barresse
Code:
Sub ExpandDataPlease()
Dim i As Long, iRow As Long
With ActiveSheet
For i = .Cells(.Rows.Count, 1).End(xlUp).Row To 1 Step -1
.Rows(i).Cut .Rows(.Cells(i, 1).Value)
Next i
End With
End Sub
Code:
Sub insertSeqRows()
Dim LR As Long, i As Long, x As Long
LR = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row ' get last row
For i = LR To 2 Step -1
x = Cells(i, "A").Value - Cells(i - 1, "A").Value
If x <> 1 Then
Rows(i).Resize(x - 1).EntireRow.Insert
End If
Next i
End Sub
(both formatted properly in in other thread)
Last edited: