I need a macro that will insert a row after each subtotal, please see picture below for desired result.
Asked
Active
Viewed 478 times
-9
-
3Good for you! Are you asking permission or did you have a specific question regarding the code you've already written? – Nov 11 '17 at 19:07
-
@Jeeped - that's the coolest I've heard anyone put it in a while :D – E. Villiger Nov 11 '17 at 19:11
-
1@E.Villiger- Even for a holiday Saturday this has to be one of the whiniest, laziest, self-entitled questions I've encountered in quite a while. – Nov 11 '17 at 19:16
1 Answers
1
For i = 1000 to 1 Step -1 ' adjust 1000 to the row number of the last element
If Cells(i,1).Font.Bold And Cells(i,1) <> "" then
Cells(i+1,1).EntireRow.Insert
End If
Next

E. Villiger
- 876
- 10
- 27
-
2
-
True, I guess it would be more solid that way, I'll edit my answer. – E. Villiger Nov 11 '17 at 19:17
-
3Always work from the bottom up when inserting or deleting rows. If not, when deleting you risk 'skipping over' rows during iteration and when inserting, you are artificially extending your range with the newly inserted rows. – Nov 11 '17 at 19:18