Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Olzki
 
Posts: n/a
Default Adding five new rows every 40 rows in a spreadsheet?

Hi,

I'm uppdating a huge spreadsheet and are in seroius need to figure out how
to add five new rows every fourtieth row. Advise anyone? Need to do this 400
times manually otherwise...


  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default


For i = 400 to step -40
Cells(i,"A").Resize(5,1).entirerow.insert
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Olzki" wrote in message
...
Hi,

I'm uppdating a huge spreadsheet and are in seroius need to figure out how
to add five new rows every fourtieth row. Advise anyone? Need to do this

400
times manually otherwise...




  #3   Report Post  
Olzki
 
Posts: n/a
Default

Thx a lot Bob.

You wouldn't also know how to program the same macro to "fill without
format" the five new rows from the last row above every time?

"Bob Phillips" skrev:


For i = 400 to step -40
Cells(i,"A").Resize(5,1).entirerow.insert
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Olzki" wrote in message
...
Hi,

I'm uppdating a huge spreadsheet and are in seroius need to figure out how
to add five new rows every fourtieth row. Advise anyone? Need to do this

400
times manually otherwise...





  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Not tested, but try

Dim i As Long
For i = 400 To 1 Step -40
Cells(i + 1, "A").Resize(5, 1).EntireRow.Insert
Cells(i, "A").EntireRow.Copy
Cells(i + 1, "A").Resize(5, 1).PasteSpecial Paste:=xlPasteValues
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Olzki" wrote in message
...
Thx a lot Bob.

You wouldn't also know how to program the same macro to "fill without
format" the five new rows from the last row above every time?

"Bob Phillips" skrev:


For i = 400 to step -40
Cells(i,"A").Resize(5,1).entirerow.insert
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Olzki" wrote in message
...
Hi,

I'm uppdating a huge spreadsheet and are in seroius need to figure out

how
to add five new rows every fourtieth row. Advise anyone? Need to do

this
400
times manually otherwise...







  #5   Report Post  
Dana DeLouis
 
Posts: n/a
Default

This is just a slight variation. I'm not sure how to do this without
copying some of the formatting, so this ideas just uses General Formatting.
You may need to adjust this.

Sub Demo()
Dim R As Long
Dim NRows As Long
Dim Inc As Long

Inc = 14
NRows = 5

For R = 100 To 1 Step -Inc
Rows(R).Resize(NRows).Insert
Rows(R).Offset(-1).Resize(NRows + 1).FillDown
Rows(R).Resize(NRows).NumberFormat = "General"
Next R
End Sub

--
Dana DeLouis
Win XP & Office 2003


"Bob Phillips" wrote in message
...
Not tested, but try

Dim i As Long
For i = 400 To 1 Step -40
Cells(i + 1, "A").Resize(5, 1).EntireRow.Insert
Cells(i, "A").EntireRow.Copy
Cells(i + 1, "A").Resize(5, 1).PasteSpecial Paste:=xlPasteValues
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Olzki" wrote in message
...
Thx a lot Bob.

You wouldn't also know how to program the same macro to "fill without
format" the five new rows from the last row above every time?

"Bob Phillips" skrev:


For i = 400 to step -40
Cells(i,"A").Resize(5,1).entirerow.insert
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Olzki" wrote in message
...
Hi,

I'm uppdating a huge spreadsheet and are in seroius need to figure
out

how
to add five new rows every fourtieth row. Advise anyone? Need to do

this
400
times manually otherwise...











  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Adding five new rows every 40 rows in a spreadsheet?

I need to add a row every second row in spreadsheets that differ in size.
Some have 100 rows & some have 600 rows. What would the macro be

"Bob Phillips" wrote:


For i = 400 to step -40
Cells(i,"A").Resize(5,1).entirerow.insert
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Olzki" wrote in message
...
Hi,

I'm uppdating a huge spreadsheet and are in seroius need to figure out how
to add five new rows every fourtieth row. Advise anyone? Need to do this

400
times manually otherwise...





  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Adding five new rows every 40 rows in a spreadsheet?

You should really make an attempt to create a new message rather than tagging
onto someone else's.

Having gotten that off my chest..............this macro looks at the used range
in column A on any worksheet and inserts a row after each existing row.

Sub InsertRows()
Application.ScreenUpdating = False
Dim numRows As Integer
Dim r As Long
r = Cells(Rows.Count, "A").End(xlUp).Row
numRows = 1
For r = r To 1 Step -1
ActiveSheet.Rows(r + 1).Resize(numRows).Insert
Next r
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Wed, 16 May 2007 19:55:00 -0700, Excel Greenie <Excel
wrote:

I need to add a row every second row in spreadsheets that differ in size.
Some have 100 rows & some have 600 rows. What would the macro be

"Bob Phillips" wrote:


For i = 400 to step -40
Cells(i,"A").Resize(5,1).entirerow.insert
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Olzki" wrote in message
...
Hi,

I'm uppdating a huge spreadsheet and are in seroius need to figure out how
to add five new rows every fourtieth row. Advise anyone? Need to do this

400
times manually otherwise...






  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Adding five new rows every 40 rows in a spreadsheet?

Sorry about that. Thanks for the macro - works like a charm.

"Gord Dibben" wrote:

You should really make an attempt to create a new message rather than tagging
onto someone else's.

Having gotten that off my chest..............this macro looks at the used range
in column A on any worksheet and inserts a row after each existing row.

Sub InsertRows()
Application.ScreenUpdating = False
Dim numRows As Integer
Dim r As Long
r = Cells(Rows.Count, "A").End(xlUp).Row
numRows = 1
For r = r To 1 Step -1
ActiveSheet.Rows(r + 1).Resize(numRows).Insert
Next r
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Wed, 16 May 2007 19:55:00 -0700, Excel Greenie <Excel
wrote:

I need to add a row every second row in spreadsheets that differ in size.
Some have 100 rows & some have 600 rows. What would the macro be

"Bob Phillips" wrote:


For i = 400 to step -40
Cells(i,"A").Resize(5,1).entirerow.insert
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Olzki" wrote in message
...
Hi,

I'm uppdating a huge spreadsheet and are in seroius need to figure out how
to add five new rows every fourtieth row. Advise anyone? Need to do this
400
times manually otherwise...







  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Adding five new rows every 40 rows in a spreadsheet?

Thanks for the feedback.

The reason I mentioned not tagging onto an existing thread is the danger of your
post not being picked up if readers/responders have assumed that thread has been
successfully dealt with and have not put a "watch thread" on it or have chosen
to "ignore thread".


Gord


On Thu, 17 May 2007 14:46:01 -0700, Excel Greenie
wrote:

Sorry about that. Thanks for the macro - works like a charm.

"Gord Dibben" wrote:

You should really make an attempt to create a new message rather than tagging
onto someone else's.

Having gotten that off my chest..............this macro looks at the used range
in column A on any worksheet and inserts a row after each existing row.

Sub InsertRows()
Application.ScreenUpdating = False
Dim numRows As Integer
Dim r As Long
r = Cells(Rows.Count, "A").End(xlUp).Row
numRows = 1
For r = r To 1 Step -1
ActiveSheet.Rows(r + 1).Resize(numRows).Insert
Next r
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Wed, 16 May 2007 19:55:00 -0700, Excel Greenie <Excel
wrote:

I need to add a row every second row in spreadsheets that differ in size.
Some have 100 rows & some have 600 rows. What would the macro be

"Bob Phillips" wrote:


For i = 400 to step -40
Cells(i,"A").Resize(5,1).entirerow.insert
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Olzki" wrote in message
...
Hi,

I'm uppdating a huge spreadsheet and are in seroius need to figure out how
to add five new rows every fourtieth row. Advise anyone? Need to do this
400
times manually otherwise...








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding rows of different info from separate worksheets into summar Barry P New Users to Excel 1 February 8th 05 02:47 PM
Disable Adding or Deleting Rows and Columns Playa Excel Discussion (Misc queries) 1 January 10th 05 10:23 PM
Adding Rows to Master Sheet Excel Newbie New Users to Excel 1 December 23rd 04 10:56 PM
adding rows Antoine Excel Discussion (Misc queries) 4 December 22nd 04 02:19 PM
Adding rows to an array chris w Excel Worksheet Functions 1 December 10th 04 02:27 AM


All times are GMT +1. The time now is 10:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"