+ Reply to Thread
Results 1 to 6 of 6

Insert rows and enter data in blank cells.

  1. #1
    Forum Contributor
    Join Date
    02-21-2013
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    122

    Insert rows and enter data in blank cells.

    Hello :-) I am trying to put together a macro and I am stuck!!!

    I need to add 3 rows at each change in the data in column C. Within those new rows I need some rows to fill down and some to enter new text and some to enter a formula.

    I have attached the example with a before and after tab.

    The data in yellow on the "after" tab will be a vlookup formula to another workbook and the data in green will be a formula. Otherwise the data will either fill down or will be specific data as shown.
    Attached Files Attached Files
    Last edited by jscalem; 02-21-2013 at 01:41 PM. Reason: Attached example

  2. #2
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: Insert rows and enter data in blank cells.

    Hey Jscalem,

    I believe you'd need a loop here.

    First try to determine the "last row"

    Secondly, when there's a change in the column C data, insert 3 rows below it.

    Third, "go to" the next data BEFORE the insert row. i.e. Before insert, the data was on row 2, now that you've insert the 3 rows, you need the code to go to row 5 to check the data and if there's a change in column C, insert, if not go to the next row, until the "last" row that you've found.

  3. #3
    Forum Contributor
    Join Date
    02-21-2013
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: Insert rows and enter data in blank cells.

    I am not familiar with working with loops. I know the code to go to the last row of data. With this portion of the macro I am kind of lost. I have gotten as far as to be able to insert the rows and copy down the data but it copies all of the data not just specific columns.

  4. #4
    Forum Contributor
    Join Date
    02-21-2013
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: Insert rows and enter data in blank cells.

    Also the number of rows will vary from one month to the next. So there could be 10 companies or there could be 100 companies.

  5. #5
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: Insert rows and enter data in blank cells.

    That's what I by determined the "last row" so that, doesn't matter what month this macro runs on, it will "know" what's the last month is. please check you PM

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Insert rows and enter data in blank cells.

    dluhut,

    Do you have the solution / code? Can you please post it here?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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