Results 1 to 3 of 3

Type Mismatch Error when deleting a cell

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-06-2004
    Posts
    121

    Type Mismatch Error when deleting a cell

    I get this error anytime I try to delete the contents of any cell (by clicking the DELETE key. Backspace works OK.) OR if I try to CLEAR CONTENTS in any cell in columns D or P.


    I do have a VBA code setup that involves those cells in those columns. Any idea how to fix this problem?

    Here's the code:

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim CurrRow As Long
        
        CurrRow = Target.Row
        
    If Target.Column = 4 Then
        If Target.Value = "" Then
                If Cells(CurrRow, 2) = 408 Then Cells(CurrRow, 2) = 43
                If Cells(CurrRow, 2) = 406 Then Cells(CurrRow, 2) = 398
        ElseIf Target.Value <= 3030 And Cells(CurrRow, 2) = 43 Then Cells(CurrRow, 2) = 408
        ElseIf Target.Value > 3030 And Cells(CurrRow, 2) = 408 Then Cells(CurrRow, 2) = 43
        ElseIf Target.Value <= 8500 And Cells(CurrRow, 2) = 398 Then Cells(CurrRow, 2) = 406
        ElseIf Target.Value > 8500 And Cells(CurrRow, 2) = 406 Then Cells(CurrRow, 2) = 398
                End If
    ElseIf Target.Column = 16 Then
        If Target.Value = "" Then
                If Cells(CurrRow, 14) = 408 Then Cells(CurrRow, 14) = 43
                If Cells(CurrRow, 14) = 406 Then Cells(CurrRow, 14) = 398
        ElseIf Target.Value <= 3030 And Cells(CurrRow, 14) = 43 Then Cells(CurrRow, 14) = 408
        ElseIf Target.Value > 3030 And Cells(CurrRow, 14) = 408 Then Cells(CurrRow, 14) = 43
        ElseIf Target.Value <= 8500 And Cells(CurrRow, 14) = 398 Then Cells(CurrRow, 14) = 406
        ElseIf Target.Value > 8500 And Cells(CurrRow, 14) = 406 Then Cells(CurrRow, 14) = 398
                End If
            End If
    End Sub
    Last edited by Josiah; 04-11-2008 at 11:51 AM.

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