Hello, I have code that inserts a certain amount of rows according to a certain cells value:
But I also want to number each row from 1 to value, so if I have the cell value set at 24, when the code is ran I want it to add 24 new rows, which it does, and I want it to number each row in column T according to the cell value, so from 1-24 for this example. Any help?
Code:
Sub addrowsc()
Dim r, count As Range
Dim LastRow As Long
Dim temp As Integer
Set r = Range("A:AM")
Set count = Range("T22")
LastRow = Range("T" & Rows.count).End(xlUp).Row
For N = LastRow To 1 Step -1
temp = Range("AI" & N)
If (temp > 1) Then
Rows(N + 1 & ":" & N + temp).Insert Shift:=xlDown
End If
Next N
End Sub
But I also want to number each row from 1 to value, so if I have the cell value set at 24, when the code is ran I want it to add 24 new rows, which it does, and I want it to number each row in column T according to the cell value, so from 1-24 for this example. Any help?