+ Reply to Thread
Results 1 to 26 of 26

New Row

  1. #1
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    New Row

    Hi. This is the macro that I currently have. As you can see it starts w/ rows(21:21), however, if row 21 is enter and you run the macro again, it starts again at row 21 hence copying down whatever is currently in row 21 to 22. I do not want this macro to do that. i want it to start at the next empty row if previous rows are occupied. how do i do that? Thanks.
    Please Login or Register  to view this content.
    Last edited by davesexcel; 12-28-2010 at 03:05 PM. Reason: code tags required please read the forum rules

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: New Row

    Please Login or Register  to view this content.
    This selects the first empty cell after the last entry in column A

    Change the column letter and column number to suite your requirements

  3. #3
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    Quote Originally Posted by davesexcel View Post
    Please Login or Register  to view this content.
    This selects the first empty cell after the last entry in column A

    Change the column letter and column number to suite your requirements
    I do not understand. Does this replace the 1st line of the formula? How would it look like?

  4. #4
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    Quote Originally Posted by ruckuz View Post
    I do not understand. Does this replace the 1st line of the formula? How would it look like?
    Can someone help, please?

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: New Row

    Hello Ruckuz,

    This version of the macro will copy the values from the previous row to the next empty row.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  6. #6
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    Quote Originally Posted by Leith Ross View Post
    Hello Ruckuz,

    This version of the macro will copy the values from the previous row to the next empty row.
    Please Login or Register  to view this content.

    Hi,
    The code above doesn't work. I'm not too familiar w/ macros so hence the dumb questioning.

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: New Row

    Hello ruckuz,

    Please Login or Register  to view this content.

    Adding the Macro
    1. Copy the macro above pressing the keys CTRL+C
    2. Open your workbook
    3. Press the keys ALT+F11 to open the Visual Basic Editor
    4. Press the keys ALT+I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Paste the code by pressing the keys CTRL+V
    7. Make any custom changes to the macro if needed at this time.
    8. Save the Macro by pressing the keys CTRL+S
    9. Press the keys ALT+Q to exit the Editor, and return to Excel.

    To Run the Macro...
    To run the macro from Excel, open the workbook, and press ALT+F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

  8. #8
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    Hi Leith,
    I know how to copy the macro to VB. The macro itself is not working like it's suppose to. Perhaps I can send you my spreadsheet so you can see what I mean?

  9. #9
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,636

    Re: New Row

    You didn't attach a sample workbook, so I don't know what you're up to.

    You seem to be saying that you want the macro to copy certain data from row 20 to the next available row on the sheet every time the macro is run.

    davesexcel's line:
    Please Login or Register  to view this content.
    loads the number of the last used row into Rws; the next available blank row is just Rws +1.
    Then you need to copy the data values from row 20 to that row:
    Please Login or Register  to view this content.
    So that the macro becomes:
    Please Login or Register  to view this content.
    Though I'm curious why, if data in row 20 is changing, it just can't be put into the next row to begin with?
    Ben Van Johnson

  10. #10
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    Please take a look at my spreadsheet.

    as you can see, row 22 only includes columns that have formulas and row 23 is blank.
    i'm looking for a macro that will copy those formulas down every time i insert a new row.

    for instance. i press a macro button to insert a new row. formulas from row 22 will copy down to row 23 and then row 24 will now become a new blank row. am i making sense? Thanks and happy new year!
    Attached Files Attached Files

  11. #11
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: New Row

    Hello ruckuz,

    Now that I can see the layout, it is clear what you want to do.

  12. #12
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    Quote Originally Posted by Leith Ross View Post
    Hello ruckuz,

    Now that I can see the layout, it is clear what you want to do.
    Thanks Leith,
    Guess I should of upload the spreadsheet earlier and make life easier for everyone. Lesson learned. The code above was close to what I'm looking for, had to change values to formula, but the formula is not totally correct and it doesnt automatically insert a new row.

    Can you help now that you see what I'm talking about? Thanks.

  13. #13
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: New Row

    Hello ruckuz,

    I don't have Excel 2007 but I have a converter to read the 2007 format. Sometimes I can change the files and save them and the changes work. In this case, it isn't working.

  14. #14
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    Quote Originally Posted by Leith Ross View Post
    Hello ruckuz,

    I don't have Excel 2007 but I have a converter to read the 2007 format. Sometimes I can change the files and save them and the changes work. In this case, it isn't working.
    Do you have the code? Won't the code be the same whether it's 2003 or 2007? I'm sure 2007 can read 2003's codes.

  15. #15
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: New Row

    Hello Ruckuz,

    I discovered you cross posted this question. Please read the forum rules regarding cross posts. It is allowed provided you list the links to other sites. This is keeps everybody on the same page. Few things p*** people off more than working hard to help you and find out your question has already been answered.

    Cross Posted Here: http://www.mrexcel.com/forum/showthread.php?t=517901

  16. #16
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    Sorry Leith,
    Didn't know Mr. Excel is connected w/ this forum. The question has not been answered. Sorry about that, won't happen again.

  17. #17
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: New Row

    Hello ruckuz,

    Not a problem. You're new here. I don't expect you to have read all the rues about posting yet. I am still working on the code and just about have it working. I copied the data over to a 2003 workbook so I could tell the difference between my code problems and those raised by converting the workbook.

  18. #18
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    Quote Originally Posted by Leith Ross View Post
    Hello ruckuz,

    Not a problem. You're new here. I don't expect you to have read all the rues about posting yet. I am still working on the code and just about have it working. I copied the data over to a 2003 workbook so I could tell the difference between my code problems and those raised by converting the workbook.
    Thank you Leith. This forum has been very helpful. I will contribute my novice expertise as much as I can.

  19. #19
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: New Row

    Hello Ruckuz,

    Here is the working macro. Copy this into Module2. You can then add a button to the worksheet (somewhere) to run the macro or do it manually.

    EDIT: I attached the workbook with the macro and the button.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Leith Ross; 12-30-2010 at 03:26 AM. Reason: Attached workbook

  20. #20
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    [SOLVED] Thanks!! Happy New Year!

  21. #21
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: New Row

    Hello Ruckuz,

    Happy New Year !

  22. #22
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    Leith,
    Sorry to be of bother yet again. I noticed that when ever i add a line, my subtotal does not include the new line that is added for instance. subtotal(9,c1:c21), line 21 is the last line before i press the macro to insert a new line. i press the macro to insert new line and instead of subtotal being subtotal(9,c1:c22), which 22 is the new line, it stays subtotal(9,c1:c21), therefore not calculating the numbers in the new line, 22.

  23. #23
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: New Row

    Hello Ruckuz,

    Thanks for pointing that out. I will work on it.

  24. #24
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    Quote Originally Posted by Leith Ross View Post
    Hello Ruckuz,

    Thanks for pointing that out. I will work on it.
    Thanks Leith.

  25. #25
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: New Row

    Hello Ruckuz,

    I replaced the Subtotal function with a Sum since that is what the Subtotal was doing. The ranges are now automatically sized and summed. The Subtotal functions in row 23 are still there. Here is the formula I used and a copy of the workbook.

    Row 21:
    =SUM(OFFSET(C$3,0,0,ROW()-3, 1))
    Attached Files Attached Files

  26. #26
    Registered User
    Join Date
    07-27-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: New Row

    i think it's finally [SOLVED] but will test to make sure. Thanks Leith!!!!

+ 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