Page 1 of 1

[Solved] Adding blank rows between rows

Posted: Tue Jan 18, 2011 5:20 pm
by Lindy
I'm starting out with a 100-row spreadsheet, each row is text and unique. What is the fastest way to insert 3 blank rows between each text row? I currently select three rows, right click, and click Insert Rows, which is very time consuming. Thank you.

Re: Adding blank rows between rows

Posted: Tue Jan 18, 2011 5:39 pm
by MrProgrammer
In a new column immediately to the right of your data, type 0 in the first cell and fill that down (use fill handle as described in Help) to create 0, 1, 2, …, 99. In the next row (that is 101) type 0.1 and fill that down to get 0.1, 1.1, 2.1, …, 99.1. Repeat to get 0.2, 1.2, 2.2, …, 99.2 and 0.3, 1.3, 2.3, …, 99.3 in the next 200 rows. Sort the 400 rows by the new column, then delete it.

If this answered your question please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.

Re: [Solved] Adding blank rows between rows

Posted: Wed Jan 19, 2011 1:36 pm
by Lindy
Pure genius, works great. Thanks a lot!

Re: [Solved] Adding blank rows between rows

Posted: Thu Nov 10, 2011 6:53 pm
by silvanet
This is not a solution! Doesn't anyone in this forum know how to program in VBA? How about somebody helping with a simple VBA routine that allows this to be done without all that incredible BS extra work?

Re: [Solved] Adding blank rows between rows

Posted: Thu Nov 10, 2011 7:39 pm
by MrProgrammer
silvanet wrote:This is not a solution!
The OP marked this as [Solved], hence it was a solution to that problem, and Lindy's response suggests that it was a good solution. Your problem is different because you want to use VBA instead of the standard user interface, and you must open a new topic. Read Don't hijack the thread of other users.

Re: [Solved] Adding blank rows between rows

Posted: Fri Nov 11, 2011 1:31 am
by kingfisher
silvanet, you should also ask that question on the Macros & API board. Before I realised you had posted in the wrong place I copied some old code. It may help you so here it is:

Code: Select all

'Define the weekly table for the stock being updated, insert a row and add to table.
Dim sWStr as String, oDBase2 as Object, oCells2 as Object, lWTop as Long, lWRight as Long, _
	lWFoot as Long
sWStr = Ucase( sCode ) & "wk" : oDBase2 = vDBases.getByName( sWStr )
oCells2 = oDBase2.ReferredCells
lWFoot = oCells2.RangeAddress.EndRow + 1 : oSheet1.Rows.insertByIndex( lWFoot, 1 )

[Solved] Adding blank rows between rows

Posted: Tue Apr 19, 2016 2:46 pm
by AlwaysPaws
It may be five years later, but this helped me tremendously. I have a spreadsheet of over 10,000 items and needed to insert two extra rows between each row. Thank you, MrProgrammer.

Re: [Solved] Adding blank rows between rows

Posted: Wed Apr 20, 2016 2:44 pm
by Lupp
I have a spreadsheet of over 10,000 items and needed to insert two extra rows between each row.
I am wondering, and a bit curious now. Would you mind to tell the reasons (probably in a somehow abstract way)? From many years of using spreadsheets I cannot remeber a case of the kind.

Re: [Solved] Adding blank rows between rows

Posted: Thu Apr 21, 2016 8:53 pm
by AlwaysPaws
Hi, I am adding products that need to be in three separate categories but I only have the categories listed on one line per item. I have about 30 categories and the sheet I'm working with has the categories all mixed up because the manufacturer uses a different categorization than I want to use on my site.

In other words, using a made-up example:
Here are three categories:

Candy Lovers candy/chocolate candy
Candy Lovers candy
Chocolate candy

Re: [Solved] Adding blank rows between rows

Posted: Mon Feb 18, 2019 12:26 am
by acheide
I used your method to double space a list by using odd numbers and then even numbers.
Thank you MrProgrammer.

Re: [Solved] Adding blank rows between rows

Posted: Wed Aug 05, 2020 7:22 pm
by John_Ha
acheide wrote:I used your method to double space a list by using odd numbers and then even numbers.
Be very cautious doing so! If you create the odd and even numbers by "cell below = cell above + 2" you are referencing the very cells you will be sorting on . While the sort does work by happenstance in this case the numbers themselves change.

See sort.ods. The numbers start as 1, 2, 3, .., 18, 19, 20 but end as 1, 2, 4, 6, 8, 10, 12, .., 34, 36, 38 after the sort on Column D.
Clipboard01.png
Clipboard01.png (5.78 KiB) Viewed 5933 times