Consulting

Results 1 to 5 of 5

Thread: Solved: Run-time error '13'

  1. #1
    VBAX Regular
    Joined
    Oct 2007
    Posts
    19
    Location

    Solved: Run-time error '13'

    Dear Friends,
    When i run the following code for supervisor column, i get the following error message.
    Run-time error '13"
    Type mismatch.

    When i debug, it's pointing to Case Is = "SOR" And "-9"

    The code.
    If Cells(1, ActiveCell.Column) <> "Job No." Then
    MsgBox "invalid column! you must select column job no."
    Else
    Rowbase = ActiveCell.Row
    columbase = ActiveCell.Column
    For RowCount = 1 To Selection.Rows.Count
    temp = Rowbase + RowCount - 1
    If temp <> 1 Then
    System = Mid(Cells(temp, columbase), 6, 3)
    Process = Mid(Cells(temp, columbase), 10, 2)
    value1 = Cells(temp, columbase)
    Select Case System And Process
    Case Is = 201 And 1
    Cells(temp, columbase + 5) = "Cheng"
    Case Is = 201 And 2
    Cells(temp, columbase + 5) = "Cheng"
    Case Is = "SOR" And "-9"
    Cells(temp, columbase + 5) = "CHENG"
    Case Else
    Cells(temp, columbase + 5) = "Unknown"
    End Select
    End If
    Next RowCount
    End If

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Select Case True
    Case System = 201 And Process = 1
    Cells(temp, columbase + 5) = "Cheng"
    Case System = 201 And Process = 2
    Cells(temp, columbase + 5) = "Cheng"
    Case System = "SOR" And Process = -"-9"
    Cells(temp, columbase + 5) = "CHENG"
    Case Else
    Cells(temp, columbase + 5) = "Unknown"
    End Select
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Oct 2007
    Posts
    19
    Location
    Dear XLD,
    Can i use wildcard to replace number
    for example
    Case
    System = "***" And Process = 1
    Cells(temp, columbase + 5) = "Cheng"

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Case System Like "*" And Process = 1: MsgBox 1
    Cells(temp, columbase + 5) = "Cheng"
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Oct 2007
    Posts
    19
    Location
    Dear Xld,
    Thank you very much..

Posting Permissions

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