+ Reply to Thread
Results 1 to 6 of 6

Worksheet_Change: Not triggered when user deletes a cell's content

  1. #1
    Registered User
    Join Date
    09-17-2013
    Location
    East
    MS-Off Ver
    Excel 2010
    Posts
    55

    Worksheet_Change: Not triggered when user deletes a cell's content

    Hey there,

    I probably have an easy one for you.

    I use the Worksheet_Change method and want to trigger a sub in case a specific cell is "x" or "".
    No problem with the "x", but if the user deletes the "x" (which should also trigger the macro since the cell's content is "" afterwards) nothing happens. It turns out, the Worksheet_Change-Event is not even called!

    How to deal with this issue? How to call the Worksheet_Change-Event if the user deletes the cell's content?

    Thanks a bunch!
    Klaster

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Worksheet_Change: Not triggered when user deletes a cell's content

    Hi, Klaster,

    show us your procedure to have a look at to decide whether the Ifs/Select Case maybe are wrong or the events are disabeld.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Worksheet_Change: Not triggered when user deletes a cell's content

    Hi Klaster,

    Coded correctly the Worksheet_Change will execute if a cell is deleted on the sheet the code is attached to.

    If you could post the workbook I may be able to provide a solution.

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  4. #4
    Registered User
    Join Date
    09-17-2013
    Location
    East
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Worksheet_Change: Not triggered when user deletes a cell's content

    Hi,
    thanks for your replies.
    The Worksheet_change-Event was actually called - I forgot to comment out my error-catching line.

    Still, I get an error in the following section, when I delete the cell's content. Here is the relevant code.

    The MsgBox works fine (since I changed Target.Value to Target.Text), but the code throws a 13-Error at the If-Statement.
    I tried IsEmpty(Target), IsEmpty(Target.Value) and IsNull(Target) instead of Target.Text = "" as well. How else could I check for an empty cell?


    Please Login or Register  to view this content.
    Thanks in advance!
    Klaster

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Worksheet_Change: Not triggered when user deletes a cell's content

    Hi, Klaster,

    both options work fine for me with a fresh workbook, no contents, no formulas, F2/Enter for an empty cell although I would use
    Please Login or Register  to view this content.
    Like stated: just for the part posted here as the error may come from the data inside the worksheet.

    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    09-17-2013
    Location
    East
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Worksheet_Change: Not triggered when user deletes a cell's content

    Hey Holger,

    thanks for your input. I tried your solution and it didn't work either. Seems as the problem was the "Or"-Statement. Breaking it down into two ElseIf-Statements "solved" the problem . Well, it's a workaround.

    Thanks for your replies! I like this forum!

    I won't set the thread to "solved" as the problem itself isn't really fixed.

+ 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 Event (If User Mouse Clicks Out of the Active Cell)
    By sadclown in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2012, 03:50 PM
  2. Replies: 3
    Last Post: 03-14-2012, 08:26 AM
  3. Worksheet_Change Not Being Triggered
    By Claymation in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-01-2010, 11:56 AM
  4. what Event is triggered when user adds/deletes rows?
    By dlh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-20-2007, 08:38 PM
  5. Why xl deletes 250+ rows using worksheet_change
    By stumanchu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2006, 03:41 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