Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jul 2004
    Location
    Sumner, Washington, USA
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error Deleting (Excel 2003/SP2)

    If a user deletes the value from a cell, I get an type mismatch error in the worksheet_change event code here:

    If Left(Target.Value, 5) = "Fixed" Then

    I've tried circumventing this code by excluding the line when the target isnull, isempty, equals an empty string, or equals 0, but those all cause the same error. What's going on? What happens between hitting delete and running the code?

    --Karyl

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error Deleting (Excel 2003/SP2)

    Are you sure that Target is a single cell? If the user clears a range of cells, Target is a multi-cell range and that doesn't have a single value, of course.

  3. #3
    2 Star Lounger
    Join Date
    Jul 2004
    Location
    Sumner, Washington, USA
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error Deleting (Excel 2003/SP2)

    Yes, it's just one cell. Well, maybe a combined cell. But it only does it some of the time to some of the cells. I think it may have something to do with the amount of validation I have going on, which is much more than I've done before. I don't know. But now I've got even more strangeness going on, so I'm going to start from scratch and recreate the whole thing. The latest bug: I can't hide a sheet. The option is grayed out, and when I try to do it via code, it says the sheet is protected (it's not). Protecting and unprotecting doesn't made a difference, nor restarting Excel, nor rebooting the computer or changing to a different machine. So, that's my homework for tonight, I guess. I will be SO glad to put this project to bed. It has been one confounding problem after another!

    --Karyl

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error Deleting (Excel 2003/SP2)

    With all the problems you've mentioned recently, it's probably not a bad idea to start from scratch.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •