+ Reply to Thread
Results 1 to 5 of 5

Macro to delete inserted row

  1. #1
    Registered User
    Join Date
    06-26-2012
    Location
    Phoenix, Arizona
    MS-Off Ver
    Excel 2010
    Posts
    27

    Macro to delete inserted row

    The following formula enables me to insert a row whenever I make a new entry in the A column.

    Please Login or Register  to view this content.
    However, I now need to put in another macro to remove the last inserted row whenever an entry is removed from the A column. I don't know how to write the macro to accomplish this function. I think the above code information may be enough to determine how the new code should be written. Please let me know if there is more information to share in order to solve this problem.

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: Macro to delete inserted row

    record a macro,
    run the delete
    stop the macro,
    edit the macro.

    remove any text of a hard defined cell reference, like Range("a1") and replace it with ACTIVECELL.

    If you are deleting a row, then where it says Rows("4:4"), change to:
    r = activecell.row
    Rows(r & ":" & r)

  3. #3
    Registered User
    Join Date
    06-26-2012
    Location
    Phoenix, Arizona
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Macro to delete inserted row

    I'm sorry, I don't know how to code the macro to delete the last row with formulas whenever a value in Column A has been erased or cleared. As it is right now, another new row is created whenever I delete a value from one of the cells on column A. It keeps compounding and I do not want that!

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro to delete inserted row

    Hello jnbroek,

    As it is right now, another new row is created whenever I delete a value from one of the cells on column A.
    I think we would need to see a sample of how you have setup your Workbook.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  5. #5
    Registered User
    Join Date
    06-26-2012
    Location
    Phoenix, Arizona
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Macro to delete inserted row

    I apologize. I realize now that a new row does NOT get inserted after a value is cleared from the A column. Instead, what happens is that the row #11 was inserted AFTER I added a value "gg" in the A5 cell (see Before file example). But when I cleared the A5 cell, row #11 still remains there (see After file example).

    Would be perfect if that colored row #11 also goes away when the value is removed from the A5 cell.

    Every time I add a new value to the A column, a new colored row with formulas gets inserted. But those inserted rows will never go away unless I manually delete them. If I give this protected workbook to a novice user, the Miscellaneous Activities worksheet could end up having rows and rows of colored rows if they keep removing values in the A column.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 7
    Last Post: 07-29-2014, 11:10 AM
  2. [SOLVED] Macro to delete an previously inserted image
    By karen2712 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-01-2013, 04:34 AM
  3. Run Macro When Comment is inserted
    By exceere in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-08-2012, 10:11 AM
  4. [SOLVED] Delete or hide Inserted comments in cell
    By Jack40 in forum Excel General
    Replies: 7
    Last Post: 10-22-2012, 10:45 PM
  5. delete Row when specific value is inserted in a cell
    By jchambers00 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2007, 03:19 PM
  6. How to delete an inserted object
    By bksanf01 in forum Excel General
    Replies: 2
    Last Post: 03-14-2007, 07:29 AM
  7. Replies: 6
    Last Post: 08-24-2005, 11:05 AM

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