I am looking to use a macro to add rows to a worksheet. the number of rows that i want to add in between each record is based on a value in one of the cells for that record.
for example:
joe blow|3
this would add 3 rows after this row. I am not that savy with vba. i have some code now that i can kind of follow what its suppose to do but when i run it, nothing happens.
the code i have i downloaded off the net. my variable number to use to add rows in my spreadsheet is listed in column H:
for example:
joe blow|3
this would add 3 rows after this row. I am not that savy with vba. i have some code now that i can kind of follow what its suppose to do but when i run it, nothing happens.
the code i have i downloaded off the net. my variable number to use to add rows in my spreadsheet is listed in column H:
Code:
Sub splenda()
'Capture row of last entry in column H
ctrlValueRow = Cells(Rows.Count, "h").End(xlUp).Row
'Loop upward thru cells in ColH; insert as needed
Do While ctrlValueRow > 0
Cells(ctrlValueRow, 8).Activate
If ActiveCell.Value > 1 Then
For i = 1 To ActiveCell.Value
ActiveCell.Offset(1, 0).EntireRow.Insert
Next i
End If
ctrlValueRow = ctrlValuRow - 1
Loop
End Sub
Last edited by a moderator: