Try it like this - enter the number of splits you want (2 to n) in oolumn L
Sub InsertRowsOnValue()
Dim r As Long, lr As Long
Dim deleterow As Long
Dim ws As Worksheet
Set ws = ActiveSheet
Dim iCol As Integer
iCol = 35
Application.ScreenUpdating = False
For deleterow = ws.Range("M" & Rows.Count).End(xlUp).Row To 6 Step -1
If ws.Range("M" & deleterow).Offset(0, -1).Value = "" Then
Rows(deleterow).EntireRow.Delete
End If
Next deleterow
With ws
lr = .Cells(Rows.Count, "L").End(xlUp).Row
For r = lr To 6 Step -1
If IsNumeric(.Cells(r, "L")) And .Cells(r, "L") > 1 Then
.Rows(r).Copy
.Rows(r + 1).Resize(.Cells(r, "L").Value).Insert
.Cells(r + 1, "M").Resize(.Cells(r, "L").Value).Value = 1 / .Cells(r, "L").Value
.Cells(r + 1, "K").Resize(.Cells(r, "L").Value).Value = .Cells(r, "K").Value / .Cells(r, "L").Value
Intersect(.Range("G:R"), .Cells(r + 1, "M").Resize(.Cells(r, "L").Value).EntireRow).Interior.ColorIndex = iCol
If iCol = 35 Then
iCol = 36
Else
iCol = 35
End If
.Cells(r + 1, "L").Resize(.Cells(r, "L").Value).Value = "Split"
.Rows(r).Delete
End If
Next r
End With
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Bookmarks