LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,420
Default inserting rows for month end dates.!

Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim LastRow As Long
Dim nMonths As Long

With ActiveSheet

LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = LastRow - 1 To 2 Step -1

nMonths = DateDiff("m", .Cells(i, TEST_COLUMN).Value, .Cells(i +
1, TEST_COLUMN).Value)
If nMonths 0 Then .Rows(i + 1).Resize(nMonths).Insert
Next i

End With

End Sub


--
__________________________________
HTH

Bob

"via135" wrote in message
...
On Jan 11, 7:17 pm, via135 wrote:
On Jan 11, 6:37 pm, via135 wrote:



hi all


i am having a list of dates "dd/mm/yyyy" format in col A as under::


1/1/2009
5/1/2009
10/2/2009
15/6/2009
30/6/2009
20/7/2009
10/9/2009
1/1/2010


what i want is to inset row for each month end dates.upto the end of
data range..?!
any hlp?


-via135


yes..i am getting the rows inserted only for the months available in
the data.
but i need rows tobe inserted for all months which are not figured in
the data also.
for instance.. i need 3 rows tobe inserted btw
10/2/2009 &
15/6/2009

hope u understand Mike..!

-via135


oops..indeed 4 rows for feb,mar,apr & may

-via135




 
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
Copying & Inserting Rows w/o Affecting other Rows Etc. LRay67 Excel Worksheet Functions 1 October 22nd 08 02:10 AM
When inserting date , how do I have the month spelled out Michael K[_2_] Excel Worksheet Functions 1 June 12th 08 05:53 PM
Sorting dates and inserting rows Andy Excel Worksheet Functions 3 June 7th 08 03:12 PM
Inserting Blank rows after every row upto 2500 rows Manju Excel Worksheet Functions 8 August 22nd 06 12:54 PM
Dates - Several Days In a month to month only Andy_Pimp Excel Discussion (Misc queries) 1 February 28th 06 11:11 AM


All times are GMT +1. The time now is 05:04 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"