+ Reply to Thread
Results 1 to 3 of 3

worksheet_change deleting row triggers deleting worksheet not working properly

  1. #1
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    273

    worksheet_change deleting row triggers deleting worksheet not working properly

    Hello,

    I'm trying to get the worksheet_change to capture user deleting rows. In the worksheet column A and column B combined forms worksheet names. I'd like to have the event deleting the corresponding worksheet when user deletes that row. for example:

    on this sheet I have
    colA colB
    1 Header Header
    2 L0001 RFSP
    3 L0002 RFSP
    4 L0003 SSGP

    then I also have worksheets with names "RFSPL0001", "RFSPL0002", "SSGPL0003"

    I need the code to delete the worksheet when user deletes a row/rows - i.e. when user deletes row 2, the code deletes worksheet "RFSPL0001". the problem with the below codes is that it always delete the next worksheet, i.e. when user deletes row2, the codes deletes worksheet "RFSPL0002". the undo and redo didn't help either. can someone please help? thanks so much in advance

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: worksheet_change deleting row triggers deleting worksheet not working properly

    Maybe you can carry out this process by designating a column as the delete column, and whenever you enter a value say "del" in that row, and hit enter, that row and the associated spreadsheet will delete.

    Here is some code you could use in this fashion. I designated column D as the Delete column.


    Please Login or Register  to view this content.
    Last edited by maniacb; 02-08-2021 at 11:07 PM. Reason: Corrections to response

  3. #3
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    273

    Re: worksheet_change deleting row triggers deleting worksheet not working properly

    Thanks very much maniacb, I decided to use a user form instead because the routine also needs to handle if user wants to delete multiple rows as well, very much appreciated the idea though, can use it somewhere else definitely!

+ 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. worksheet_change not working properly
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-21-2015, 01:25 PM
  2. Excel crashes / stops working properly after deleting a worksheet
    By Pedsdude in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-02-2014, 05:11 AM
  3. Runtime error when deleting a row in Worksheet_Change
    By markiz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-28-2013, 03:01 AM
  4. Run time error 13 when deleting more than one cell with Worksheet_Change event macro
    By som3on3_10 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-22-2010, 12:19 PM
  5. [SOLVED] Disabling worksheet_change when deleting rows . .
    By Adam in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-16-2006, 12:10 PM
  6. [SOLVED] Prevent error when deleting row within Worksheet_Change target ran
    By Peter Rooney in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-01-2006, 11:45 AM
  7. deleting values in a worksheet without deleting the formulas
    By patti in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-28-2005, 05:05 PM

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