Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22
Default Need Macro- Insert rows based on dates and copy info from that row

I need a macro
that will insert a number of blank rows
based on the number of months between a start and end date
and then copy the information in the reference row to the new blank rows.

repeat for each start and end date sequence.

The records are over 8,350.. so ill also need some idea how to get it to
stop when it fills the worksheet so i can transfer those into another workbook

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 834
Default Need Macro- Insert rows based on dates and copy info from that row

Assuming start date in column A, end date in column B

Public Sub ProcessData()
Dim i As Long
Dim LastRow As Long
Dim NumRows As Long

With ActiveSheet

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

NumRows = .Cells(i, "B").Value2 - .Cells(i, "A").Value2
If NumRows 0 Then

.Rows(i + 1).Resize(NumRows).Insert
.Rows(i).Copy .Cells(i + 1, "A").Resize(NumRows)
End If
Next i
End With

End Sub


--

HTH

Bob

"Katerinia" wrote in message
...
I need a macro
that will insert a number of blank rows
based on the number of months between a start and end date
and then copy the information in the reference row to the new blank rows.

repeat for each start and end date sequence.

The records are over 8,350.. so ill also need some idea how to get it to
stop when it fills the worksheet so i can transfer those into another
workbook



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
Macro to copy previous row and insert two blank rows dd Excel Discussion (Misc queries) 1 April 30th 07 11:25 PM
Macro that will Cut rows and then insert-copy or append rod Excel Discussion (Misc queries) 3 October 21st 06 04:50 PM
Copy and insert cell info macro help JackR Excel Discussion (Misc queries) 2 March 21st 06 03:22 PM
MACRO - copy rows based on value in column to another sheet Michael A Excel Discussion (Misc queries) 1 March 5th 05 02:15 AM
Activate a macro to insert a row and copy the formuals from the rows above to the blank row oil_driller Excel Discussion (Misc queries) 1 February 11th 05 03:30 PM


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