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

0
Utf
4/6/2010 6:31:20 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
841 Views

Similar Articles

[PageSpeed] 10

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" <Katerinia@discussions.microsoft.com> wrote in message 
news:C8AE1783-91D1-4DC3-9D76-6F18BBBC7369@microsoft.com...
>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
> 


0
Bob
4/6/2010 7:02:17 PM
Reply:

Similar Artilces:

Not sure if Excel can do what i need
Hello all, I am obviously a new user to excel. I have a psychological assessmen that needs to be computerised for ease of use in obtaining results. Here is what i would like to happen. I have 28 questions with fiv Likert scale options(0-4) for answers. Each question addresses 1 of different personality traits. So questions 1, 6, 8, 22 look at anger. Where as questions 2, 9, 28 look at happiness. What i would like is fo excel to group the answers and give me the total number for each trait. Then based on that number, give out a prewritten (which i would provide result of the assessment. ...

Need Min Value from Row and Heading Value that Corresponds to it.
I have a table that looks somewhat like this w/o the *'d headings: h1 h2 h3 h4 h5 h6 h7 *Min Price *Heading $5.00 $6.00 $3.00 $4.00 $9.00 $1.00 $9.00 $1.00 h6 $3.00 $6.00 $8.00 $65.00 $9.00 $2.00 $4.00 $2.00 h6 $4.00 $9.00 $5.00 $7.00 $1.00 $2.00 $8.00 $1.00 h5 $9.00 $7.00 $6.00 $3.00 $9.00 $8.00 $2.00 $2.00 h7 $7.00 $8.00 $9.00 $7.00 $9.00 $8.00 $8.00 $7.00 h1 I have several SKU's with various price contract/programs. I want to find the best price in one cell and the heading that would correspond to that cell in another. I was trying to do this with an expression ...

Match value in one column and return value in same row in next col
Hi, I have a a set of values in A1 through A100. I need to look up each value and find a match in another set of values located in C1 through C200. If a match is found then I need the formula located in column B to return the value in the same row but the next column over (D). Example: A B C D 359 375 10012 456 125 10031 125 10031 952 10052 854 444 10017 The formula located in B3 should find that the value of 125 (located in A3) matches the value in C2 and returns 10031 which is the v...

Date shows as 01/01/00
We have a spreadsheet that we want to enter a date in a cell. I have changed the format to Date 03/01/01 format but no matter what I do, any date is converted to 01/01/00. I have tried inserting a column, copying to another spreadsheet, etc. I know this is probably simple, but it's driving me crazy. Help please. In an un-used cell enter: =TODAY() if this is not the correct date, then touch CNTRL-ALT-F9 on the keyboard post what happens. -- Gary''s Student "Kmagg" wrote: > We have a spreadsheet that we want to enter a date in a cell. I have changed > the...

Excel need help
I have 2 columns a and b . a contains payment b contains balance. I have the entire col b with the formula. my ? is when the balance appearsin b it is in all the cells in that column.I only want it in the used ones, not the unused ones:( example $270.00 16,730.00 $270.00 16,460.00 $100.00 16,360.00 $300.00 16,060.00 $270.00 15,790.00 15,790.00 15,790.00 15,790.00 15,790.00 15,790.00 this 15790.00 is in col b...not a...I want no bal in unused cells -- fiftieslady ------------------------------------------------------------------------ fiftieslady's Profile: http://www.excelforum.co...

Do I have to use Conditional Formatting or a Macro?
Hi All, I have a table like this: Value1 Value2 Value3 aq x 3 aa y 5 The cells under 'Value2' already have a ConditionalFormatting (with 3 conditions) to change the background color. I'd like to know if it's possible to apply a format (ie just border) to the entire row, and copy the ConditionalFormatting regarding the 'Value2' column, as soon as I insert a new record in 'Value1'. That is, when cells under 'Value' are not blank, then the row will have a border, and cell under 'Value2' has ConditionalFormatting...

Need Help Linking Sheets
How can I link 2 pages without using the actual sheet as a reference? In other words, can I have two sheets linked by Identifying the same exact names one on each sheet? ...

Excel newbie needs help from math wiz (poker related)
I want to create a Excel workbook that will help in specific poker situations. Short version: I want to be able to calculate how often my opponent will need to fold for an all-in raise to show a positive expectation. Explanation: In poker you can win a hand by having the best hand at the end OR getting your opponent to fold. A common situation comes up where you have a "drawing hand" and face a bet by your opponent. In this situation you know you are currently behind in the hand, but have a chance to win if you catch some of your "outs" (cards that will give you th...

Macro help needed........
How do I sort a particular column in ascending order and change the pag setup to landscape and margins to 0.25 using a macro code ? does anyone have a macro code for this ????? -- Message posted from http://www.ExcelForum.com Hi you have already received some answers in your previous threads please don't multipost! -- Regards Frank Kabel Frankfurt, Germany > How do I sort a particular column in ascending order and change the > page setup to landscape and margins to 0.25 using a macro code ? > > does anyone have a macro code for this ?????? > > > --- > Me...

Date Format Conversion?
I have a tab delimited text file with a column of dates. I copied and pasted a selection of them below as a reference, there are in reality over 35,000 rows of these dates. These text dates must be converted to the following date format and saved back into a text file as such: mm/dd/yyyy That includes leading zeroes in months and dates. E.g. 01/01/1999 To complicate matters, I need to explain the process to others. Does anyone even know where I should begin? THANK YOU, - Chris +++++++++++++++++++++++++++ 9031989 8131990 9201989 1271990 10291989 1081990 3041990 10051989 4191990 10...

Need to test a mobo
I had a power surge about 3 weeks ago - lost a drive, now making ticking noises. I had another two drive that seem to work sporadically now. So, I thought it might have been my power supply. Bought a tester and found out that all seems well. Next, I bought a new hard drive and found that it was also acting up - making noises like whirring up and down (like the other drives I thought were dead). So I am starting to wonder if it is my mobo - but how can I test this out? I am using a dual boot - Win XP and Win 7 - both drives work and don't work. Up and down. Right now my Win7 ...

Help needed
is there anyway you can see what links to other workbooks are associated with the workbook you have open. The problem i am having is when i open the workbook in question a message appears and states "The workbook you opened contains automatic links to information in another workbook. do you want to update this workbook with changes made to the other workbook" Yes....... No. if i click No the workbook opens, however if i click Yes the workbook just hangs and i have to go into task manager to shut down the system. I can only assume that there is a problem with one of the links....

Publisher 2002 Inserting a landscape page into portrait document
How can I insert one landscape page into a presentation consisting portrait pages? I understand the inserting of page numbers, but I can't find the page orientation. Publisher does not allow you to have different orientation pages. Group all items on the page and rotate 90�. -- ...

error in dates
Hi! I keep having problems when I type the date 6/16/86 in Excel, even if i format it, it won't display as a date. Can anyone help me? Thanks. Hi check the format of your cell prior to entering the date. Probably the cell format is set to 'Text'. change this to 'General' or a date format and after this enter your date -- Regards Frank Kabel Frankfurt, Germany cheng wrote: > Hi! I keep having problems when I type the date 6/16/86 > in Excel, even if i format it, it won't display as a > date. Can anyone help me? Thanks. If your regional setting is using d...

Macro to sort a predefined list
I need to make a button on my excel sheet that will sort a pre-defined area (A2:K103) on my sheet the same way as selecting the area manually and then selecting sort. Can this be done and how? Record a macro while doing this, then attach it to a button from the forms toolbar -- Regards, Peo Sjoblom (No private emails please, for everyone's benefit keep the discussion in the newsgroup/forum) <rob_summers@sbcglobal.net> wrote in message news:G3jEc.9827$pw6.5954@newssvr24.news.prodigy.com... > I need to make a button on my excel sheet that will sort a pre-defined area > ...

Linking errors with MFC Dialog Based application and Crypto++ #2
* bump * Any suggestions? Please... * bump * -- Crocodil ------------------------------------------------------------------------ Posted via http://www.codecomments.com ------------------------------------------------------------------------ Could you provide the linking error you have got! ...

Need help on this....thanks
I have an Excel worksheet which stored a survey outcome of over 1200 members. There are over 30 questions in the survey and the first column captured the member ID. The problem is 3 of the survey questions that allow multiple answers, instead the answer for those three questions are captured in seperate column, the answers are stored in a single column and it makes it very difficult to analysis those result. As a result I created addittional columns depending on the total number of the answers available for that question and assign the result manually to that column. It is very time consuming ...

I need Help
I have a random popup that i cant stop,when it does come up it seems to know what i was looking at,like when i was looking for registry cleaner it popped up and showed me one,any help would be great. On Jan 22, 6:57=A0am, Larry <La...@discussions.microsoft.com> wrote: > I have a random popup that i cant stop,when it does come up it seems to k= now > what i was looking at,like when i was looking for registry cleaner it pop= ped > up and showed me one,any help would be great. To eliminate questions and guessing, please provide additional information about your sys...

need help badly
How do you print ole objects.. Thanks lachanda -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200710/1 On Wed, 03 Oct 2007 18:13:40 GMT, "misschanda via AccessMonster.com" <u36612@uwe> wrote: >How do you print ole objects.. >Thanks >lachanda What *kind* of OLE objects? Many of them are binary blobs (such as programs) which are inherently not printable. More details please! John W. Vinson [MVP] ...

Stuck in review and need to be in design.
I am using Visio 2007. I need to complete the diagram that I have been working on and I hit the review key by mistake. How do I get back to the design screen? On Wed, 4 Nov 2009 16:14:01 -0800, cameron <cameron@discussions.microsoft.com> wrote: >I am using Visio 2007. I need to complete the diagram that I have been >working on and I hit the review key by mistake. How do I get back to the >design screen? menu Tools -> Track Markup and then close the Review window. -- Regards, Paul Herber, Sandrila Ltd. DFD/SSADM for Visio http://www.visio-dfd.sa...

VBA code to run macro in certain file based on name of file in cel
I am trying to come up with code that will run a macro in a workbook where the path and name of the workbook are in a cell reference. I have tried the following with no luck. The path to the file is located in cell F36 of worksheet, "Customize" and the name of the file is located in cell F42. The name of the macro is "ClearTotalSavings". Any help from one of you gurus would sure be appreciated. Application.Run "'" & Workbooks(Sheets("Customize").Range("F36").Value) & "\" & Sheets("Customize").R...

Need Help Despertly!
I am in a desperate situation. I had to reformat my hard drive. Prior to do this, I copied my entire User Profile to another drive. I can now access my User Profile information from Windows Explorer. Now that I installed Microsoft Outlook, I do not see any of my Contacts. I need to restore my Contacts to the new Outlook installation. Again, I did save my entire "User Profile" from my previous installation of Windows 2000 Professional. I just do not know how to access my Contact information from Outlook that included addresses and phone numbers and such. Any help would be greatly appr...

Plug in needed
Looking for an Outlook plug in which, on reply to a e-mail, will:- a) allow selective quoting only, and b) not top quote. Anything around at all? Much to my horror (sorry guys) the Boss wants us to use Outofluck at work! -- On the carpool lane lane to Nirvana. John Phillips <flatulentdingo@deadspam.com> wrote: > Looking for an Outlook plug in which, on reply to a e-mail, will:- > > a) allow selective quoting only, and > > b) not top quote. > > Anything around at all? The best Outlook adjunct I've found for quote handling on replies is Outlook-Quotef...

Adding textboxes based on what user inputs in Total Students textb
Hi All, How can I add text boxes on the form based on what user inputs in a textbox? For eg: I have a textbox "Total Students" , so Once I input a number in that textbox, I want to have that many textboxes on the form. If I input 4 I want four textboxes to be displayed on the form. In addition to this: I want all this textboxes to be displayed in a specific frame, I have made this frame as "vertically scrollable" as I have limited space on my form and want to fit in as many textbo, Is there a way to do this? Thanks in advance ...

What is the Need for XSD in Application Blocks designing
Can anyone help in clearing my doubt Hi, There is a need for me to implement Application Blocks in my project, (Basically 3 tire), the project comprises of UIL, BLL,Business Entities, DAL.. When i saw the example programs from User Interface Application Block example, which is implementing the Business Layer part, Interface for BLL and Business Entity part where by i am not able to understand the real usage of XSD's and the autogenerated C#? Can anyone explain me what is the process flow behind this fuda in a simple terms. Thanks in Advance Jagadeesh ...