+ Reply to Thread
Results 1 to 4 of 4

Changing InsertRows macro to select entire last row

  1. #1
    Registered User
    Join Date
    05-20-2010
    Location
    New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    4

    Changing InsertRows macro to select entire last row

    Hi,

    I'm using the InsertRows macro found at http://dmcritchie.mvps.org/excel/insrtrow.htm to add rows in a worksheet and copy the formulas from the cells in the last row.

    The macro as it's written on that page makes a selection based on the current active cell. I've tried adapting it to select the last row with data, so that it will add a new row below that, with no luck - the closest I have got is copying the row without any formulas.

    Any help with adapting would be much appreciated.

    Thanks
    Last edited by Alistar3000; 05-03-2011 at 12:12 AM.

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Changing InsertRows macro to select entire last row

    Example:

    if row 5 contains the formulae to be copied:

    Please Login or Register  to view this content.



  3. #3
    Registered User
    Join Date
    05-20-2010
    Location
    New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Changing InsertRows macro to select entire last row

    That sort of works. I changed it to:

    Rows(2).Copy Rows(Cells.SpecialCells(xlCellTypeLastCell).Rows +1)

    To try and get it to add a row under the last row with data, which works until a row is added, then deleted, as the next row will still be under the deleted row leaving a blank row between (and it gets worse if even more rows are deleted and added).

    Also, this copies the values and the formulae. Is there a way to get it to only copy the formulae? So that the cells don't display the data from row 2?

    Thanks

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Changing InsertRows macro to select entire last row

    Please Login or Register  to view this content.
    or
    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