Macro insert rows depending on # in Column B
Thanks so much. Works Great!
--
Splendalisa
"Jay" wrote:
Hi Splenda -
Here's an updated version that correctly addresses the case where there is a
control value in row 1, column B. My previous post did not address that case
properly:
Sub splenda()
'Capture row of last entry in column B
ctrlValueRow = Cells(Rows.Count, "B").End(xlUp).Row
'Loop upward thru cells in ColB; insert as needed
Do While ctrlValueRow 0
Cells(ctrlValueRow, 2).Activate
If ActiveCell.Value 0 Then
For i = 1 To ActiveCell.Value
ActiveCell.Offset(1, 0).EntireRow.Insert
Next i
End If
ctrlValueRow = ctrlValueRow - 1
Loop
End Sub
---
Jay
|