+ Reply to Thread
Results 1 to 2 of 2

Insert Different Number of Rows based on Cell, Copy Previous Data and slightly change it.

  1. #1
    Registered User
    Join Date
    05-30-2013
    Location
    Seattle
    MS-Off Ver
    Excel 2010
    Posts
    1

    Insert Different Number of Rows based on Cell, Copy Previous Data and slightly change it.

    Hi,

    I'm newer to VBA and I'm struggling to create a macro that would really help me out. I have attached two excel sheets, one with the data (patton.xlsx) and another with what I want the data to look like after the macro (pattonafter.xlsx).

    What I'd like it to do is insert n-1 rows based on Column C. For instance, C2 is 5 so I need to insert 4 new rows beneath the original. However, I would also like those new inserted rows to copy all of the data from row 2 (in this instance) except for Column G. I would like 1 to be added to G for each new insert.

    Example if A2 is Bunny, B2 is Hammer, C2 is 4, D2 is Seattle, E2 is 3, F2 is 4, and G2 is 60
    Then I need to create rows 3, 4, 5 where A2 = A3 = A4 = A5, B2 = B3 = B4 = B5, ... all the way to G where G3 = G2 +1, G4 = G3+1 (or G2 + 2) and G5 = G4 + 1 or (G2 + 3)

    I need this to happen throughout the entire sheet for every row.

    patton.xlsx pattonafter.xlsx

  2. #2
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: Insert Different Number of Rows based on Cell, Copy Previous Data and slightly change

    here you go:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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