+ Reply to Thread
Results 1 to 12 of 12

Macro to insert specific number of rows, populate rows with data above except date

  1. #1
    Registered User
    Join Date
    04-24-2014
    Location
    Glendale, Colorado
    MS-Off Ver
    Excel 2013
    Posts
    49

    Macro to insert specific number of rows, populate rows with data above except date

    Hello,

    I am hoping to get help with a macro or solution to insert blank rows below existing data based on a number contained in the same worksheet, and populate the rows with the data above except for two columns, which would hopefully be populated with the month after the date in the source row.

    I have a list which fulfills a request for documents. The list is attached. In rows 'E' & 'F' the range of documents we requested is given, in row 'J' the number of documents fulfilled is given. For instance on row 2, statements were requested for the months of AUG and SEP 2012 and for that request, 2 documents were fulfilled. I was hoping to get a VBA for something that can help me break these ranges out and give each month requested its own line.

    The steps are simple, and they in the 2nd attachment also below-

    Need to insert number of blank rows based on number value in "available requested"- in attached sheet, column 'k'
    Copy data from above into blank rows, leaving range columns blank
    Clear contents of 'Range_To'
    fill blanks in 'Range_From' with first date of next month
    copy 'Range_From' date into column to the right
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to insert specific number of rows, populate rows with data above except date

    Does this help any?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-24-2014
    Location
    Glendale, Colorado
    MS-Off Ver
    Excel 2013
    Posts
    49

    Re: Macro to insert specific number of rows, populate rows with data above except date

    Yes! this will do the first several steps. It accurately adds the number of rows which is very helpful.

    I still need the macro to fill the blank rows in column e with the date of the first day of the following month, something I can't do manually very easily..

  4. #4
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Macro to insert specific number of rows, populate rows with data above except date

    to fill the blank rows

    Please Login or Register  to view this content.
    Kind regards
    Leo

  5. #5
    Registered User
    Join Date
    04-24-2014
    Location
    Glendale, Colorado
    MS-Off Ver
    Excel 2013
    Posts
    49

    Re: Macro to insert specific number of rows, populate rows with data above except date

    Leo-
    Thank you but the filled dates are wrong- see attachment, would need the first date of the following month added in, right now it is doing January 2012?

    Thank you again!
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Macro to insert specific number of rows, populate rows with data above except date

    did you change the first line in code ?

    Please Login or Register  to view this content.
    because if i run the code it is perfect


    Kind regards
    Leo

  7. #7
    Registered User
    Join Date
    04-24-2014
    Location
    Glendale, Colorado
    MS-Off Ver
    Excel 2013
    Posts
    49

    Re: Macro to insert specific number of rows, populate rows with data above except date

    I've tried it and re-tried it, and I still get it filling in January as the next month...not sure why?

  8. #8
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Macro to insert specific number of rows, populate rows with data above except date

    What result you get in this ?
    with the code in macro 1
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    04-24-2014
    Location
    Glendale, Colorado
    MS-Off Ver
    Excel 2013
    Posts
    49

    Re: Macro to insert specific number of rows, populate rows with data above except date

    With the cod ein Macro one I get

    01/09/12 1/9/2012

    where it should be 9-1-2012. I checked formatting issues but I don't think that's the cause of it.

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to insert specific number of rows, populate rows with data above except date

    Try:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    04-24-2014
    Location
    Glendale, Colorado
    MS-Off Ver
    Excel 2013
    Posts
    49

    Re: Macro to insert specific number of rows, populate rows with data above except date

    This does the trick! THANK YOU John!!!

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to insert specific number of rows, populate rows with data above except date

    You're welcome. Glad to help out and thanks for the feedback.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. I need to populate a given number of rows starting at a specific location
    By nmetayer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-03-2014, 01:06 PM
  2. [SOLVED] Macro code to insert 3 rows on spreadsheet with variable number of rows
    By D18GE in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2013, 07:33 AM
  3. [SOLVED] Macro to insert blank rows so that the total number of rows with data is equal to 1021
    By nsm1411 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-07-2013, 10:25 AM
  4. [SOLVED] VBA insert/delete rows to accommodate exact number of rows from incoming data
    By iloc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-12-2012, 06:19 PM
  5. Replies: 0
    Last Post: 10-23-2012, 04:59 PM
  6. [SOLVED] Insert Multiple Rows Based Off Number in Cell and Copy Data From Above New Rows
    By tstell1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2012, 04:15 PM
  7. Need Macro to insert a Specific number of Rows (in Filtered list)
    By JTwrk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2012, 08:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1