Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Cool
 
Posts: n/a
Default Insert blank rows repeatedly between every data row in Excel

Could you guide me please....

I need to insert 5 blank rows repeatedly between every existing data rows
for approximately 300 rows.

If I go about doing the repeat short-cut "Control+Y", it just repeats
inserting ONE row only between the consecutive data row.

Is there some command, which helps me highlight all the rows & allows me to
insert 5 blank rows between every consecutive existing data row?

Thanks in advance for your kind advice.
  #2   Report Post  
Posted to microsoft.public.excel.misc
abcdexcel
 
Posts: n/a
Default Insert blank rows repeatedly between every data row in Excel


Hi

Being very new to excel coding, this code might be lengthy, but it
works.

Public Sub insert_row()
Const TestColumn As Long = 1 'have taken column A as 1, thus B would be
2'
Dim cRows As Long
Dim i As Long

cRows = Cells(Rows.Count, TestColumn).End(xlUp).Row
For i = cRows To 2 Step -1
If Cells(i, TestColumn).Value < IsNotBlank Then
Cells(i, TestColumn).EntireRow.Insert
Cells(i, TestColumn).EntireRow.Insert
Cells(i, TestColumn).EntireRow.Insert
Cells(i, TestColumn).EntireRow.Insert
Cells(i, TestColumn).EntireRow.Insert
End If
Next i

End Sub


Hope this suffice your cause.

SAS


--
abcdexcel
------------------------------------------------------------------------
abcdexcel's Profile: http://www.excelforum.com/member.php...o&userid=30021
View this thread: http://www.excelforum.com/showthread...hreadid=499280

  #3   Report Post  
Posted to microsoft.public.excel.misc
JMay
 
Posts: n/a
Default Insert blank rows repeatedly between every data row in Excel

The 7 lines of code you have between the For Line and the Next line can be
replaced with the following 3 lines of code:

Cells(i, TestColumn).Select
ActiveCell.Rows("1:4").EntireRow.Insert
ActiveCell.Offset(-1, 0).Select

''' Just one alternative,,,
FWIW...


"abcdexcel" wrote in
message ...

Hi

Being very new to excel coding, this code might be lengthy, but it
works.

Public Sub insert_row()
Const TestColumn As Long = 1 'have taken column A as 1, thus B would be
2'
Dim cRows As Long
Dim i As Long

cRows = Cells(Rows.Count, TestColumn).End(xlUp).Row
For i = cRows To 2 Step -1
If Cells(i, TestColumn).Value < IsNotBlank Then
Cells(i, TestColumn).EntireRow.Insert
Cells(i, TestColumn).EntireRow.Insert
Cells(i, TestColumn).EntireRow.Insert
Cells(i, TestColumn).EntireRow.Insert
Cells(i, TestColumn).EntireRow.Insert
End If
Next i

End Sub


Hope this suffice your cause.

SAS


--
abcdexcel
------------------------------------------------------------------------
abcdexcel's Profile:
http://www.excelforum.com/member.php...o&userid=30021
View this thread: http://www.excelforum.com/showthread...hreadid=499280



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing Microsoft query data into excel changes linked rows Wazzy_bear Links and Linking in Excel 1 December 19th 05 10:09 AM
EXCEL HELP (ROWS & DATA) pam Excel Discussion (Misc queries) 0 December 9th 05 04:18 PM
From several workbooks onto one excel worksheet steve Excel Discussion (Misc queries) 6 December 1st 05 09:03 AM
Excel 2003, Convert EXISTING Worksheet Data to XML? [email protected] Excel Discussion (Misc queries) 4 November 16th 05 05:45 AM
Activate a macro to insert a row and copy the formuals from the rows above to the blank row oil_driller Excel Discussion (Misc queries) 1 February 11th 05 04:30 PM


All times are GMT +1. The time now is 11:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"