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 » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

insert and copy



 
 
Thread Tools Display Modes
  #1  
Old April 22nd, 2009, 06:56 AM posted to microsoft.public.excel.worksheet.functions
Darius
external usenet poster
 
Posts: 47
Default insert and copy

Hi there;
I need to insert a row between row 4 and 5 and then jump 5 rows further and
do it again (insert row between row 9 and 10) again 5 jumps and insert row
between 14 and 15. this goes to finally between rows 49180 and 49181.

thanks for any help
  #2  
Old April 22nd, 2009, 08:17 AM posted to microsoft.public.excel.worksheet.functions
OssieMac
external usenet poster
 
Posts: 862
Default insert and copy

Hi Darius,

To be sure of giving you the correct answer, need to confirm some info.

insert a row between row 4 and 5 then insert row between row 9 and 10. Do
you mean between what is row 9 and 10 after the row is inserted between 4 and
5 or between what was the original row 9 and 10 before inserting the row
between 4 and 5?

I have assumed the latter and the following code should do it. However, if
not correct then get back to me.

Ensure that you back up your workbook before running the code in case it
does not do what you expect.

Sub InsertRows()
Dim i As Long

For i = 49180 To 4 Step -5
Rows(i).Insert
Next i

End Sub


--
Regards,

OssieMac


"Darius" wrote:

Hi there;
I need to insert a row between row 4 and 5 and then jump 5 rows further and
do it again (insert row between row 9 and 10) again 5 jumps and insert row
between 14 and 15. this goes to finally between rows 49180 and 49181.

thanks for any help

  #3  
Old April 22nd, 2009, 08:17 AM posted to microsoft.public.excel.worksheet.functions
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default insert and copy

Try this macro..

Sub Macro()
For lngRow = 5 To 49180 Step 5
Rows(lngRow).Insert
Next
End Sub
--
If this post helps click Yes
---------------
Jacob Skaria


"Darius" wrote:

Hi there;
I need to insert a row between row 4 and 5 and then jump 5 rows further and
do it again (insert row between row 9 and 10) again 5 jumps and insert row
between 14 and 15. this goes to finally between rows 49180 and 49181.

thanks for any help

  #4  
Old April 22nd, 2009, 08:45 AM posted to microsoft.public.excel.worksheet.functions
Jarek Kujawa[_2_]
external usenet poster
 
Posts: 775
Default insert and copy

would this macro be of help?

Sub aaaaa()
Dim cell As Range

For Each cell In Columns(1).Cells
cell.Activate
If cell.Row 49181 And cell.Row Mod 5 = 0 Then
ActiveCell.Rows.EntireRow.Insert
End If
Next cell

End Sub



On 22 Kwi, 07:56, Darius wrote:
Hi there;
I need to insert a row between row 4 and 5 and then jump 5 rows further and
do it again (insert row between row 9 and 10) again 5 jumps and insert row
between 14 and 15. this goes to finally between rows 49180 and 49181.

thanks for any help


 




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:38 PM.


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