Add blank cells

Nerdalert314

New Member
Joined
Mar 28, 2018
Messages
23
Good afternoon,

I am trying to create a Macro to add a blank cell in-between line. Every month when we do this there is no way to know how many lines we will have. Manually doing these I do the following:
Number the cells next to the date and auto fill all the way down. Copy the numbers. Paste them directly under the last number. Filter smallest to largest. I have included an example below that you can hopefully follow along with. Any suggestions would be great. Thank you!

[TABLE="width: 412"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]SAMPLE 1[/TD]
[TD][/TD]
[TD]X # OF CELLS[/TD]
[/TR]
[TR]
[TD]SAMPLE 2[/TD]
[TD][/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 3[/TD]
[TD][/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 4[/TD]
[TD][/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 5[/TD]
[TD][/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 6[/TD]
[TD][/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 7[/TD]
[TD][/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 8[/TD]
[TD][/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 9[/TD]
[TD][/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 10[/TD]
[TD][/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SAMPLE 1[/TD]
[TD="align: right"]1[/TD]
[TD] # THE CELLS WITH AUTOFILL[/TD]
[/TR]
[TR]
[TD]SAMPLE 2[/TD]
[TD="align: right"]2[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 3[/TD]
[TD="align: right"]3[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 4[/TD]
[TD="align: right"]4[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 5[/TD]
[TD="align: right"]5[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 6[/TD]
[TD="align: right"]6[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 7[/TD]
[TD="align: right"]7[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 8[/TD]
[TD="align: right"]8[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 9[/TD]
[TD="align: right"]9[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 10[/TD]
[TD="align: right"]10[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SAMPLE 1[/TD]
[TD="align: right"]1[/TD]
[TD] Paste the # under the last #[/TD]
[/TR]
[TR]
[TD]SAMPLE 2[/TD]
[TD="align: right"]2[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 3[/TD]
[TD="align: right"]3[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 4[/TD]
[TD="align: right"]4[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 5[/TD]
[TD="align: right"]5[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 6[/TD]
[TD="align: right"]6[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 7[/TD]
[TD="align: right"]7[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 8[/TD]
[TD="align: right"]8[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 9[/TD]
[TD="align: right"]9[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 10[/TD]
[TD="align: right"]10[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]2[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]3[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]4[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]5[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]6[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]7[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]8[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]9[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]10[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SAMPLE 1[/TD]
[TD="align: right"]1[/TD]
[TD] Sort smallest to largest by column B[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 2[/TD]
[TD="align: right"]2[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]2[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 3[/TD]
[TD="align: right"]3[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]3[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 4[/TD]
[TD="align: right"]4[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]4[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 5[/TD]
[TD="align: right"]5[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]5[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 6[/TD]
[TD="align: right"]6[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]6[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 7[/TD]
[TD="align: right"]7[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]7[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 8[/TD]
[TD="align: right"]8[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]8[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 9[/TD]
[TD="align: right"]9[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]9[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SAMPLE 10[/TD]
[TD="align: right"]10[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]10[/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
How about
Code:
Sub AddBlanks()
   Dim i As Long
   For i = Range("A" & Rows.count).End(xlUp).Row To 2 Step -1
      Rows(i).Insert
   Next i
End Sub
This assumes your data is in col A
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top