Select Case with Nested Like Code Not Working

  • My Code:


    Sub SelectCaseTestUTH()


    Dim RowNum As Long
    RowNum = 2
    Do Until Cells(RowNum, 4).Value = ""
    Select Case Cells(RowNum, 4).Value
    Case Is = Cells(RowNum, 4).Value Like "2ERWF*": Cells(RowNum, 5).Value = "WAFER"
    Case Is = Cells(RowNum, 4).Value Like "SE*": Cells(RowNum, 5).Value = "PARTS"
    Case Is = Cells(RowNum, 4).Value Like "SM*": Cells(RowNum, 5).Value = "BUSINESS SUPPORT"
    Case Is = Cells(RowNum, 4).Value Like "CH-WT*": Cells(RowNum, 5).Value = "CHEMICAL"
    Case Else
    Cells(RowNum, 5).Value = "OTHER"
    End Select
    RowNum = RowNum + 1
    Loop


    End Sub




    My Result:


    Items that start with with the prefix SE- and SM- (in column 4) are being defined as "Other" in column 5!! Is there something wrong with my 'Like' function that doesn't recognize that prefix?

  • try this

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!