mainepepmp
Electrical
I am trying to get Excel to automatically insert blank rows between rows of data, in proportion to the numerical difference between the value of the same field in successive rows.
Any insights?
Any insights?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub InsertBlankRows()
Dim i As Long, n As Long, a As Long
i = 2
n = ActiveSheet.UsedRange.Rows.Count
Do While i < n
a = (Cells(i, 1).Value - Cells(i - 1, 1).Value)
If a > 1 Then
Range(Cells(i, 1), Cells(i + a - 2, 1)).EntireRow.Insert
i = i + a - 1
n = n + a - 1
ElseIf a < 1 Then
a = (90 - Cells(i - 1, 1).Value) + Cells(i, 1).Value
Range(Cells(i, 1), Cells(i + a - 2, 1)).EntireRow.Insert
i = i + a - 1
n = n + a - 1
End If
i = i + 1
Loop
End Sub