pplpeople8
New Member
- Joined
- Dec 1, 2017
- Messages
- 4
Hi -
I'm trying to run the below code so I can auto insert rows based on the value of column B. The data looks like:
[TABLE="class: MsoNormalTable, width: 119"]
<tbody>[TR]
[TD="width: 64"] [/TD]
[TD="width: 95"] [/TD]
[/TR]
[TR]
[TD="width: 64"] [/TD]
[TD="width: 95"] [/TD]
[/TR]
[TR]
[TD="width: 64"] [/TD]
[TD="width: 95"] [/TD]
[/TR]
[TR]
[TD="width: 64"] [/TD]
[TD="width: 95"] [/TD]
[/TR]
[TR]
[TD="width: 64"] [/TD]
[TD="width: 95"] [/TD]
[/TR]
[TR]
[TD="width: 64"] [/TD]
[TD="width: 95"] [/TD]
[/TR]
[TR]
[TD="width: 64"] [/TD]
[TD="width: 95"] [/TD]
[/TR]
[TR]
[TD="width: 64"] [/TD]
[TD="width: 95"] [/TD]
[/TR]
</tbody>[/TABLE]
Here is the Code:
Sub Insert()<o></o>
Sheets("TEST").Select<o></o>
Dim End_Row AsLong, n As Long, Ins As Long<o></o>
End_Row =Range("B" & Rows.Count).End(xlUp).Row<o></o>
<o></o>
Application.ScreenUpdating = False<o></o>
For n = End_Row To1 Step -1<o></o>
<o> </o>
Ins = Cells(n,"B").Value<o></o>
<o> </o>
If Ins > 0Then<o></o>
Range("B" & n + 1 & ":B" & n + Ins -1).EntireRow.Insert<o></o>
End If<o></o>
<o> </o>
Next n<o></o>
End Sub
*** My error is a type 13 mismatch. Please help!! Thanks !! <o></o>
****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">Sub Insert()
Sheets("TEST").Select
Dim End_Row As Long, n As Long, Ins As Long
End_Row = Range("B" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
For n = End_Row To 1 Step -1
Ins = Cells(n, "B").Value
If Ins > 0 Then
Range("B" & n + 1 & ":B" & n + Ins - 1).EntireRow.Insert
End If
Next n
End Sub
</body>
I'm trying to run the below code so I can auto insert rows based on the value of column B. The data looks like:
[TABLE="class: MsoNormalTable, width: 119"]
<tbody>[TR]
[TD="width: 64"]
String<o></o>
[TD="width: 95"]
Rows Needed<o></o>
[/TR]
[TR]
[TD="width: 64"]
1003<o></o>
[TD="width: 95"]
0<o></o>
[/TR]
[TR]
[TD="width: 64"]
1004<o></o>
[TD="width: 95"]
0<o></o>
[/TR]
[TR]
[TD="width: 64"]
1005<o></o>
[TD="width: 95"]
0<o></o>
[/TR]
[TR]
[TD="width: 64"]
1006<o></o>
[TD="width: 95"]
0<o></o>
[/TR]
[TR]
[TD="width: 64"]
1007<o></o>
[TD="width: 95"]
2<o></o>
[/TR]
[TR]
[TD="width: 64"]
1008<o></o>
[TD="width: 95"]
1<o></o>
[/TR]
[TR]
[TD="width: 64"]
1012<o></o>
[TD="width: 95"]
0<o></o>
[/TR]
</tbody>[/TABLE]
Here is the Code:
Sub Insert()<o></o>
Sheets("TEST").Select<o></o>
Dim End_Row AsLong, n As Long, Ins As Long<o></o>
End_Row =Range("B" & Rows.Count).End(xlUp).Row<o></o>
<o></o>
Application.ScreenUpdating = False<o></o>
For n = End_Row To1 Step -1<o></o>
<o> </o>
Ins = Cells(n,"B").Value<o></o>
<o> </o>
If Ins > 0Then<o></o>
Range("B" & n + 1 & ":B" & n + Ins -1).EntireRow.Insert<o></o>
End If<o></o>
<o> </o>
Next n<o></o>
End Sub
*** My error is a type 13 mismatch. Please help!! Thanks !! <o></o>
****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">Sub Insert()
Sheets("TEST").Select
Dim End_Row As Long, n As Long, Ins As Long
End_Row = Range("B" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
For n = End_Row To 1 Step -1
Ins = Cells(n, "B").Value
If Ins > 0 Then
Range("B" & n + 1 & ":B" & n + Ins - 1).EntireRow.Insert
End If
Next n
End Sub
</body>