Insert Rows

LtCmdrData

Board Regular
Joined
Jan 24, 2018
Messages
58
Office Version
  1. 365
Platform
  1. Windows
I am looking for a quick VBA solution. I have a range of numbers (not consecutive) in one column, 881 to be exact. I need to insert 146 blank rows in between each number, then move to the next number in the same column and then insert 146 more blank rows, until I reach the end. Does anyone have a simple solution so I don't have to do this manually? Thanks!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
How about
Code:
Sub LtCmdrData()
Dim i As Long
For i = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
    Rows(i).Resize(146).Insert
Next i
End Sub
 
Upvote 0
That worked great, just what I wanted it to do. That saved me a lot of work.

Could I ask 1 more question please?
I have a block of data, 147 rows by 23 columns wide, that I need to insert by each number I just separated. Could the VBA code you gave me be modified to accomplish this task? The block of data doesn't change, it just repeats. Thanks in advance.
 
Upvote 0
Do you mean that each row should be repeated 14 times?
 
Upvote 0

Forum statistics

Threads
1,215,013
Messages
6,122,690
Members
449,092
Latest member
snoom82

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