Results 1 to 3 of 3

Code "debug" error msg

Threaded View

  1. #1
    Registered User
    Join Date
    02-20-2009
    Location
    Mineral, VA
    MS-Off Ver
    Excel 2003
    Posts
    73

    Code "debug" error msg

    The two code extracts below are associated with two separate worksheets in the same workbook. They work fine. They simply are used to assign either a PO# or a Temp Unit #, located in a third sheet, in their respective sheets.

    The problem is that when I'm in either the Master or the Work Orders sheets where these two codes are used, and I do something simple like drag down some values or paste something in a cell, I get the "Run time error "13" type mismatch error" in the popup debug window for my VBA code. And in each case, it highlights the codeline I've color coded below:

    Work Orders Code:
    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    '    If Target.Count > 1 Then Exit Sub
        If Not Intersect(Target, Range("K3:K1500")) Is Nothing And UCase(Target.Value) = "X" Then
            Range("L" & Target.Row).Value = Sheets("Assign").Range("E" & Rows.Count).End(xlUp).Offset(1, -1).Value
            Sheets("Assign").Range("E" & Rows.Count).End(xlUp).Offset(1, 0).Value = "X"
           
        End If
    End Sub
    Master Code
    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    '    If Target.Count > 1 Then Exit Sub
        If Not Intersect(Target, Range("D3:D1000")) Is Nothing And UCase(Target.Value) = "X" Then
            Range("C" & Target.Row).Value = Sheets("Assign").Range("B" & Rows.Count).End(xlUp).Offset(1, -1).Value
            Sheets("Assign").Range("B" & Rows.Count).End(xlUp).Offset(1, 0).Value = "X"
       
        End If
    End Sub
    My problem is I'm so new to this type of coding that I'm totally lost as to what it is really telling me or what to do. It doesn't keep me from doing what I need to do nor does it interfere with what the code does..I just don't know how to fix it.

    I've attached the sample spreadsheet.
    Attached Files Attached Files
    Last edited by cedarhill; 05-29-2009 at 05:27 PM.

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