A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Insert Rows in b/w



 
 
Thread Tools Display Modes
  #1  
Old February 4th, 2009, 01:10 PM posted to microsoft.public.excel.newusers
Ranjit kurian
external usenet poster
 
Posts: 38
Default 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  
Old February 4th, 2009, 01:36 PM posted to microsoft.public.excel.newusers
Bernard Liengme
external usenet poster
 
Posts: 4,085
Default 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  
Old February 4th, 2009, 02:44 PM posted to microsoft.public.excel.newusers
Ranjit kurian
external usenet poster
 
Posts: 38
Default 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  
Old February 4th, 2009, 03:06 PM posted to microsoft.public.excel.newusers
Don Guillett
external usenet poster
 
Posts: 6,167
Default 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  
Old February 4th, 2009, 08:51 PM posted to microsoft.public.excel.newusers
Bernard Liengme
external usenet poster
 
Posts: 4,085
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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