+ Reply to Thread
Results 1 to 4 of 4

Macro - Insert Row and continue formulas

  1. #1
    Registered User
    Join Date
    12-17-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    80

    Macro - Insert Row and continue formulas

    Hello I'm trying to put together a macro that will insert a row and continue the formulas (not the values) of the row above. This way the user has a new row, with working formulas to enter data.

    I've found something that kind of works, but it is run manually (through Alt+F8) and needs a cell to be active selected. I'd like this macro to run upon a button click. No matter where/if a cell is selected.

    Attached is an example which has the macro I found that does some of what we need, hopefully this will help aid in communicating the situation. Any help is greatly appreciated.
    Attached Files Attached Files

  2. #2
    Forum Contributor Mayda89's Avatar
    Join Date
    09-13-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    192

    Re: Macro - Insert Row and continue formulas

    Hi Fett2005,

    Could you tell me how do you want to determine where to insert the new rows?

    Cheers,

  3. #3
    Registered User
    Join Date
    12-17-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    80

    Re: Macro - Insert Row and continue formulas

    The users will fill out the information at the next available row. So the next available row.
    In the example there is a primary and a secondary area. when filling out data in either the user will fill out the data and need the next row below to fill out more data for the next item.

    In the example data is in row 27. When the user wants to enter data for the next item they would go to row 28, enter data, need another? go to row 29 enter data etc... etc...

    In the Primary area, rows would need to be inserted to move everything down. Data is entered on row 24, if they need to enter data for another item, they'd click the command button running the macro to insert a row below the previous row that has data and formulas continued.

  4. #4
    Forum Contributor Mayda89's Avatar
    Join Date
    09-13-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    192

    Re: Macro - Insert Row and continue formulas

    I guess the problem of "runnning the code no matter which cell is selected" can be solved by naming.
    1-Name the header rows of your each table. For example for the primary table's header, select the 6'th row end name it as "HeaderPrimary"
    ; than name the empty row where there is currently a button, namely the row numbered 25 as "EndPrimary"

    The first two lines in the code below will get you the row number of those rows.
    Please Login or Register  to view this content.
    The last line of code will give you the row number of the first empty row, in the first column, between the headerrow and endrow.

    Do the same to the Secondary table.

    Activating the macro with the button
    There is something wrong with the two buttons present on your sheet, I don't know what.
    I can't right click them!
    Anyway, just add a new button and associate it with your macro. (there shouldn't be any problems with that, I tried).

    Cheers,

+ 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