Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default insert rows in list

Column A is lists each week beginning in 6-Jan-01 until the present. I would
like to create something that automatically inserts a row after every month
since the file has 400+ rows and each month varies from 4-5 weeks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default insert rows in list

Evelyn,

I don't understand.
Is column A simply a list of dates?
A month is 28, 29, 30 or 31 days long and not 4 or 5 weeks where do you want
the line inserting?
If the list is from 6/1/01 until today I make that 3000 rows. Please
clarify.

Mike

"Evelyn" wrote:

Column A is lists each week beginning in 6-Jan-01 until the present. I would
like to create something that automatically inserts a row after every month
since the file has 400+ rows and each month varies from 4-5 weeks.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default insert rows in list

Hi Mike,

Column A is listed below but begins in Jan 2001 and goes until the current
week. I want to be able to have rows inserted after every month so a row
would automatically be inserted after the 4 rows of Jan, then the 4 rows of
Feb, 5 rows of Mar, etc...

6-Jan-01
13-Jan-01
20-Jan-01
27-Jan-01
3-Feb-01
10-Feb-01
17-Feb-01
24-Feb-01
3-Mar-01
10-Mar-01
17-Mar-01
24-Mar-01
31-Mar-01


"Mike H" wrote:

Evelyn,

I don't understand.
Is column A simply a list of dates?
A month is 28, 29, 30 or 31 days long and not 4 or 5 weeks where do you want
the line inserting?
If the list is from 6/1/01 until today I make that 3000 rows. Please
clarify.

Mike

"Evelyn" wrote:

Column A is lists each week beginning in 6-Jan-01 until the present. I would
like to create something that automatically inserts a row after every month
since the file has 400+ rows and each month varies from 4-5 weeks.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default insert rows in list

Evelyn

Right click your sheet tab, view code and paste this in and run it

Sub sonic()
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For x = lastrow To 2 Step -1
If Month(Cells(x, 1)) < Month(Cells(x - 1, 1)) Then
Rows(x).EntireRow.Insert
End If
Next
End Sub

Mike

"Evelyn" wrote:

Hi Mike,

Column A is listed below but begins in Jan 2001 and goes until the current
week. I want to be able to have rows inserted after every month so a row
would automatically be inserted after the 4 rows of Jan, then the 4 rows of
Feb, 5 rows of Mar, etc...

6-Jan-01
13-Jan-01
20-Jan-01
27-Jan-01
3-Feb-01
10-Feb-01
17-Feb-01
24-Feb-01
3-Mar-01
10-Mar-01
17-Mar-01
24-Mar-01
31-Mar-01


"Mike H" wrote:

Evelyn,

I don't understand.
Is column A simply a list of dates?
A month is 28, 29, 30 or 31 days long and not 4 or 5 weeks where do you want
the line inserting?
If the list is from 6/1/01 until today I make that 3000 rows. Please
clarify.

Mike

"Evelyn" wrote:

Column A is lists each week beginning in 6-Jan-01 until the present. I would
like to create something that automatically inserts a row after every month
since the file has 400+ rows and each month varies from 4-5 weeks.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default insert rows in list

Wow, that worked like a charm. Thanks for your help! Mike's help = awesome.

"Mike H" wrote:

Evelyn

Right click your sheet tab, view code and paste this in and run it

Sub sonic()
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For x = lastrow To 2 Step -1
If Month(Cells(x, 1)) < Month(Cells(x - 1, 1)) Then
Rows(x).EntireRow.Insert
End If
Next
End Sub

Mike

"Evelyn" wrote:

Hi Mike,

Column A is listed below but begins in Jan 2001 and goes until the current
week. I want to be able to have rows inserted after every month so a row
would automatically be inserted after the 4 rows of Jan, then the 4 rows of
Feb, 5 rows of Mar, etc...

6-Jan-01
13-Jan-01
20-Jan-01
27-Jan-01
3-Feb-01
10-Feb-01
17-Feb-01
24-Feb-01
3-Mar-01
10-Mar-01
17-Mar-01
24-Mar-01
31-Mar-01


"Mike H" wrote:

Evelyn,

I don't understand.
Is column A simply a list of dates?
A month is 28, 29, 30 or 31 days long and not 4 or 5 weeks where do you want
the line inserting?
If the list is from 6/1/01 until today I make that 3000 rows. Please
clarify.

Mike

"Evelyn" wrote:

Column A is lists each week beginning in 6-Jan-01 until the present. I would
like to create something that automatically inserts a row after every month
since the file has 400+ rows and each month varies from 4-5 weeks.

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
automatically insert new rows in a list Brighella Setting up and Configuration of Excel 1 March 14th 08 08:37 AM
How to auto insert rows in a list of numbers zdek Excel Discussion (Misc queries) 3 June 16th 06 10:19 PM
how do I insert 4 rows in between each value in a list of data Callum Excel Discussion (Misc queries) 2 April 13th 06 03:40 PM
Excel Macro to insert rows in a list MartyCole Excel Worksheet Functions 1 May 13th 05 07:51 PM
HOW CAN I AUTOMATICALLY INSERT ALTERNATE BLANK ROWS IN A LIST? Phil A. Excel Discussion (Misc queries) 1 April 19th 05 04:10 PM


All times are GMT +1. The time now is 02:52 AM.

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

About Us

"It's about Microsoft Excel"