If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Insert Rows in b/w
Hi
I have a column with few number, i need a macro code which will insert 4 rows after every number example: Amount 1 2 3 4 5 Answer: 1 2 3 4 |
#2
|
|||
|
|||
Insert Rows in b/w
Sub Macro1()
For irow = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1 For k = 1 To 4 Cells(irow, "A").EntireRow.Insert Next k Next irow End Sub best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "Ranjit kurian" wrote in message ... Hi I have a column with few number, i need a macro code which will insert 4 rows after every number example: Amount 1 2 3 4 5 Answer: 1 2 3 4 |
#3
|
|||
|
|||
Insert Rows in b/w
This code is working fine,Thanks for it.
Could you please explain me the 'irow' concept "Bernard Liengme" wrote: Sub Macro1() For irow = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1 For k = 1 To 4 Cells(irow, "A").EntireRow.Insert Next k Next irow End Sub best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "Ranjit kurian" wrote in message ... Hi I have a column with few number, i need a macro code which will insert 4 rows after every number example: Amount 1 2 3 4 5 Answer: 1 2 3 4 |
#4
|
|||
|
|||
Insert Rows in b/w
try this
Sub insertrows() For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1 Rows(i).Resize(4).Insert Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Ranjit kurian" wrote in message ... Hi I have a column with few number, i need a macro code which will insert 4 rows after every number example: Amount 1 2 3 4 5 Answer: 1 2 3 4 |
#5
|
|||
|
|||
Insert Rows in b/w
It is just a variable name, I could have used "j"
best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "Ranjit kurian" wrote in message ... This code is working fine,Thanks for it. Could you please explain me the 'irow' concept "Bernard Liengme" wrote: Sub Macro1() For irow = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1 For k = 1 To 4 Cells(irow, "A").EntireRow.Insert Next k Next irow End Sub best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "Ranjit kurian" wrote in message ... Hi I have a column with few number, i need a macro code which will insert 4 rows after every number example: Amount 1 2 3 4 5 Answer: 1 2 3 4 |
Thread Tools | |
Display Modes | |
|
|