Hello everyone - junior programmer wanna be here who is ready for a Xanax. I am trying to insert X number of rows below each visible row (X = Total Count column of that row). I want to copy the original row into the X number of rows and then repeat for all remaining rows. Any help would be greatly appreciated!!
[TABLE="border: 0, cellpadding: 0, cellspacing: 0"]
[tr]
[TD="width: 55"]Issuer[/TD]
[TD="width: 127"]Facility[/TD]
[TD="width: 78"]LoanX ID[/TD]
[TD="width: 60"]Price[/TD]
[TD="width: 53"]Depth[/TD]
[TD="width: 92"]Total Count[/TD]
[TD="width: 55"]Issuer A[/TD]
[TD="width: 127"]Term Loan B[/TD]
[TD="width: 78"]LXAAAA1[/TD]
[TD="width: 60, align: right"]100.771[/TD]
[TD="width: 53"]LoanX 3[/TD]
[TD="width: 92"]2[/TD]
[TD="width: 55"]Issuer B[/TD]
[TD="width: 127"]2017 Class B Term Loan[/TD]
[TD="width: 78"]LXAAAA2[/TD]
[TD="width: 60, align: right"]100.216[/TD]
[TD="width: 53"]LoanX 9[/TD]
[TD="width: 92"]2[/TD]
[TD="width: 55"]Issuer C[/TD]
[TD="width: 127"]Term Loan B[/TD]
[TD="width: 78"]LXAAAA3[/TD]
[TD="width: 60, align: right"]100.625[/TD]
[TD="width: 53"]LoanX 2[/TD]
[TD="width: 92"]3[/TD]
[TD="width: 55"]Issuer D[/TD]
[TD="width: 127"]Term Loan B-1[/TD]
[TD="width: 78"]LXAAAA4[/TD]
[TD="width: 60, align: right"]100.797[/TD]
[TD="width: 53"]LoanX 4[/TD]
[TD="width: 92"]4[/TD]
[TD="width: 55"]Issuer E[/TD]
[TD="width: 127"]New Term Loan B[/TD]
[TD="width: 78"]LXAAAA5[/TD]
[TD="width: 60, align: right"]100.95[/TD]
[TD="width: 53"]LoanX 5[/TD]
[TD="width: 92"]6[/TD]
[/TABLE]
Sub Copy_Rows_Down()
Dim sh As Worksheet
Set sh = Worksheets("Sheet1")
Dim LastRow As Long
LastRow = Range("AA" & Rows.count).End(xlUp).Row
Dim totalTRADES As Range
Set totalTRADES = ActiveCell.Offset(0, 6).Select
Dim i As Long, j As Long
i = 3
Do While i <= LastRow
For j = 1 To totalTRADES
sh.Rows(i).Copy
sh.Rows(i).Offset(1).Insert Shift:=xlDown
Next j
i = i + totalTRADES + 1
LastRow = LastRow + totalDS
Loop