+ Reply to Thread
Results 1 to 14 of 14

Insert Rows

  1. #1
    Forum Contributor
    Join Date
    01-03-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2016,Excel 2013
    Posts
    186

    Insert Rows

    --------------------------------------------------------------------------------

    Hi Guys,

    I have basically 2 sheets of same structure. The First sheet holds data and flow into the second sheet to perform some calculations. I need a macro to do the following,

    --> In Sheet A, when the rows gets exhausted (I have a row for totals Say Row 715) before this total Row, I need a new row to be populated automatically (I mean macros based on event) and copy the formula from above.
    To illustrate, when row 714 is filled up, a new row should populate between row 714 and row 715(Total Row) and copy the formula only from Row 714.

    --> The above should happen in Sheet B at the same specified rows .

    Any help is much appreciated.

    Thanks

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Insert Rows

    Can you post a dummy workbook?
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Forum Contributor
    Join Date
    01-03-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2016,Excel 2013
    Posts
    186

    Re: Insert Rows

    Hi Dave,

    Please see a sample workbook as attached.
    Hope this helps.

    Thanks
    Attached Files Attached Files

  4. #4
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Insert Rows

    Hey,

    Give this workbook a try

    The macro will only fire when you enter a value in the cell above the cell with the string "Total" in it on sheet 1.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JapanDave; 01-21-2012 at 07:09 AM.

  5. #5
    Forum Contributor
    Join Date
    01-03-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2016,Excel 2013
    Posts
    186

    Re: Insert Rows

    Thanks Dave.

    Just wondering now whether it would be possible to insert 100 rows instead of 1 row.
    If so can you give the code or update straight on the workbook.

    Thanks once again for your help.

  6. #6
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Insert Rows

    Hey ,
    Try this, again the cell above the total cell will fire the macro.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    01-03-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2016,Excel 2013
    Posts
    186

    Re: Insert Rows

    Hi Dave

    Sorry to note that now I realise that my two sheets are not indentical. No of Columns with formula in sheet2 varies with sheet1.
    However there is a text called "Total" under Column A in both the sheets. I want to insert 100 rows before this row which has "Total" under column A.
    The macro should also copy formula from above. Note no of columns in Sheet 2 are different in Sheet 1.
    Can you resend the code please?

    Many Thanks

  8. #8
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Insert Rows

    Can you attach the workbook with the new layout?

  9. #9
    Forum Contributor
    Join Date
    01-03-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2016,Excel 2013
    Posts
    186

    Re: Insert Rows

    Hi Dave,

    I have atttached the sheet and also put a note in sheet 1.
    Hope this is clear.
    Thanks

    Appreciate your help.
    Attached Files Attached Files

  10. #10
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Insert Rows

    What columns in sheet 2 do you want formulas input into?

  11. #11
    Forum Contributor
    Join Date
    01-03-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2016,Excel 2013
    Posts
    186

    Re: Insert Rows

    Columns A to Column AF in Sheet 2
    Last edited by Mysore; 01-23-2012 at 12:18 AM.

  12. #12
    Forum Contributor
    Join Date
    01-03-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2016,Excel 2013
    Posts
    186

    Re: Insert Rows

    Hi Dave,

    Any luck yet?
    Thanks

  13. #13
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Insert Rows

    OK,

    The code is done. I need emphasize that the format or layout can not be changed or the Macro will cease to work.

    When there is less than 100 rows in column A the macro will fire and insert 100 extra rows and so on and so forth.

    Please Login or Register  to view this content.
    This code fires the Macro above,

    Please Login or Register  to view this content.
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    01-03-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2016,Excel 2013
    Posts
    186

    Re: Insert Rows

    Thank you very much Dave. Appreciate your efforts. Many Thanks
    Last edited by Mysore; 02-05-2012 at 09:58 PM. Reason: SOLVED

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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