Wilconcl51
New Member
- Joined
- Oct 10, 2023
- Messages
- 26
- Office Version
- 2016
- Platform
- Windows
I'm using Excel On Line
My spreadsheet has 2 columns. Colum A = Name ; Column B= Number
I'm using code to add rows below based on the Number in Column B. eg B = 2 then 2 rows inserted; B=3 then 3 rows inserted.
Code
My spreadsheet has 2 columns. Colum A = Name ; Column B= Number
I'm using code to add rows below based on the Number in Column B. eg B = 2 then 2 rows inserted; B=3 then 3 rows inserted.
Code
Sub InsertRows() Dim i As Long, lRow As Long With ActiveSheet lRow = .Cells(.Rows.Count, 2).End(xlUp).Row For i = lRow To 1 Step -1 If IsNumeric(Cells(i,2)) Then .Rows(i + 1).Resize(Cells(i, 11)).Insert End If Next End With End Sub How can I change code to insert Rows and Copy Name in Row above to inserted Rows Many thanks |