ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   inserting three rows (https://www.excelbanter.com/excel-programming/392729-inserting-three-rows.html)

[email protected]

inserting three rows
 
how can I insert three rows between rows of data. right now all i have
is activecell.insert but that only inserts one row.

Dim k As Integer
Dim w As Integer
For w = 1 To 6
For k = 0 To 100
h = ((2 * (k + 1)) - 1)
Cells(h, w).Activate
ActiveCell.Insert


Mike H

inserting three rows
 
I can't see where your macro gets a value for h from but one methed of
inserting a full row would be.

Selection.EntireRow.Insert

Mike

" wrote:

how can I insert three rows between rows of data. right now all i have
is activecell.insert but that only inserts one row.

Dim k As Integer
Dim w As Integer
For w = 1 To 6
For k = 0 To 100
h = ((2 * (k + 1)) - 1)
Cells(h, w).Activate
ActiveCell.Insert



Bernie Deitrick

inserting three rows
 

Sub test()
Dim k As Integer

For k = 100 To 1 Step -1
Cells(k, 1).Resize(3, 6).Insert
Next k

End Sub


HTH,
Bernie
MS Excel MVP


wrote in message
ups.com...
how can I insert three rows between rows of data. right now all i have
is activecell.insert but that only inserts one row.





joel

inserting three rows
 
Dim k As Integer
Dim w As Integer
For w = 1 To 6
For k = 0 To 100
h = ((2 * (k + 1)) - 1)
Cells(h, w).Activate
Rows(ActiveCell.Row & ":" & (ActiveCell.Row + 2)).Insert


"Mike H" wrote:

I can't see where your macro gets a value for h from but one methed of
inserting a full row would be.

Selection.EntireRow.Insert

Mike

" wrote:

how can I insert three rows between rows of data. right now all i have
is activecell.insert but that only inserts one row.

Dim k As Integer
Dim w As Integer
For w = 1 To 6
For k = 0 To 100
h = ((2 * (k + 1)) - 1)
Cells(h, w).Activate
ActiveCell.Insert




All times are GMT +1. The time now is 12:17 AM.

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