ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   programmatically insert multiple blank rows in worksheet (https://www.excelbanter.com/excel-programming/273088-programmatically-insert-multiple-blank-rows-worksheet.html)

tag

programmatically insert multiple blank rows in worksheet
 
This is the code to insert a blank row after each row of
data in my worksheet. I need to convert it to inserting 7
blank rows afer each row of data. So far...no luck.
Can anyone assist?
Thanks in advance!!

Sub Insert_Blank_Rows()

'Select last row in worksheet.
Selection.End(x1Down).Select

Do Until ActiveCell.Row = 1
'Insert blank row.
ActiveCell.EntireRow.Insert shift:=x1Down
'Move up one row.
ActiveCell.Offset(-1, 0).Select
Loop

End Sub


Rob Bovey

programmatically insert multiple blank rows in worksheet
 
Try changing the following line of code:

ActiveCell.EntireRow.Insert shift:=x1Down

to

ActiveCell.Resize(7).EntireRow.Insert shift:=x1Down

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"tag" wrote in message
...
This is the code to insert a blank row after each row of
data in my worksheet. I need to convert it to inserting 7
blank rows afer each row of data. So far...no luck.
Can anyone assist?
Thanks in advance!!

Sub Insert_Blank_Rows()

'Select last row in worksheet.
Selection.End(x1Down).Select

Do Until ActiveCell.Row = 1
'Insert blank row.
ActiveCell.EntireRow.Insert shift:=x1Down
'Move up one row.
ActiveCell.Offset(-1, 0).Select
Loop

End Sub




Dave Peterson[_3_]

programmatically insert multiple blank rows in worksheet
 
and change x(one)down to x(ell)down.


Rob Bovey wrote:

Try changing the following line of code:

ActiveCell.EntireRow.Insert shift:=x1Down

to

ActiveCell.Resize(7).EntireRow.Insert shift:=x1Down

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *

"tag" wrote in message
...
This is the code to insert a blank row after each row of
data in my worksheet. I need to convert it to inserting 7
blank rows afer each row of data. So far...no luck.
Can anyone assist?
Thanks in advance!!

Sub Insert_Blank_Rows()

'Select last row in worksheet.
Selection.End(x1Down).Select

Do Until ActiveCell.Row = 1
'Insert blank row.
ActiveCell.EntireRow.Insert shift:=x1Down
'Move up one row.
ActiveCell.Offset(-1, 0).Select
Loop

End Sub


--

Dave Peterson


Rob Bovey

programmatically insert multiple blank rows in worksheet
 
"Dave Peterson" wrote in message
...
and change x(one)down to x(ell)down.


LOL! Yeah, that would help, wouldn't it? <g

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Dave Peterson" wrote in message
...
and change x(one)down to x(ell)down.


Rob Bovey wrote:

Try changing the following line of code:

ActiveCell.EntireRow.Insert shift:=x1Down

to

ActiveCell.Resize(7).EntireRow.Insert shift:=x1Down

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *

"tag" wrote in message
...
This is the code to insert a blank row after each row of
data in my worksheet. I need to convert it to inserting 7
blank rows afer each row of data. So far...no luck.
Can anyone assist?
Thanks in advance!!

Sub Insert_Blank_Rows()

'Select last row in worksheet.
Selection.End(x1Down).Select

Do Until ActiveCell.Row = 1
'Insert blank row.
ActiveCell.EntireRow.Insert shift:=x1Down
'Move up one row.
ActiveCell.Offset(-1, 0).Select
Loop

End Sub


--

Dave Peterson





All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com