+ Reply to Thread
Results 1 to 7 of 7

Worksheet change event not responding to cell deletion

  1. #1
    Forum Contributor
    Join Date
    09-30-2008
    Location
    Eau Claire, WI
    Posts
    184

    Worksheet change event not responding to cell deletion

    This is part of a macro in a worksheet_change event. When a cell in column J gets deleted by a user, the corresponding cell in column K should also clear. But it's not responding to the delete. It DOES clear when the other 2 criteria are met (.cells(1,10) = 0 and .cells(i,5) <> "Annuity"). The worksheet_change event should pick up on the cell deletion, but it's not. And column J is already a trigger for the macro to run, so I'm not sure what's going on. Either the trigger is still wrong, the isempty(.cells(i,10)) is not correct syntax, or this event just doesn't respond to cell deletion. Any ideas? Help! I've posted the workbook as well.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jman0707; 11-14-2008 at 06:31 PM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    What sheet has that code?

    My simple routine to check A1 using IsEmpty() worked fine.

    Not sure why you are looping through several cells if just one in the target group was changed.

  3. #3
    Forum Contributor
    Join Date
    09-30-2008
    Location
    Eau Claire, WI
    Posts
    184
    Kenneth - Sheet3, AKA "NML Inventory" has the code. And I only typed in a portion of the macro in my first post. Thanks!

  4. #4
    Forum Contributor
    Join Date
    09-30-2008
    Location
    Eau Claire, WI
    Posts
    184
    And I think the person that helped me with this had it check them all upon worksheet change is because when you filter or sort it changes the locations of all the entries, and the value in all cells in K need to follow their buddy cells in J??? That is what needs to happen, so maybe that's why it's written like that. Let me know your thoughts on a remedy once you check out the worksheet. Thanks for your help!

  5. #5
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    I tried to use it in Excel 2003 and it couldn't exit design mode due to Commandbutton3. Maybe you can save just sheet1 and sheet3 to an xls.

    Your Compile button in the VBE should be greyed. Mine is not because it won't compile.

  6. #6
    Forum Contributor
    Join Date
    09-30-2008
    Location
    Eau Claire, WI
    Posts
    184
    Here try this one. I unprotected the worksheet, so maybe that will help. I can't just post the worksheet because they are all tied in together. But I also pasted the full code below so maybe you can re-adjust it to just evaluate the line that the target changes. It isn't in design mode either. I also realized that it wouldn't need to run the macro after a filter/sort because each row would move completely together. So you might be right about just doing one line at a time, it might get the delete to take effect, and may perhaps speed up the macro. Let me know your thoughts!

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    09-30-2008
    Location
    Eau Claire, WI
    Posts
    184
    I figured it out. I added this following code to the bottom of the event. It turns out that for some reason it likes the columns wording better than naming a range. I know it's probably redundant, but it works!


    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