thanks, his code update appears to work but has highlighted the fact that my search lines do not work correctly. Any suggestions of having the search string look for cells that contain the identified values within the text and return the entire cell contents if a match occurs?
SubTest()
For Each pCell In Range("C2:C" & Range("B" & Rows.Count).End(xlUp).Row) 'your range can be whatever
If InStr(1, pCell.Value, "TSC") <> 0 And _
InStr(1, pCell.Value, "MOBILE") <> 0 And _
InStr(1, pCell.Value, "410WED") <> 0 Then
Else: Select Case Len(pCell)
Case Is = 6
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],3)"
Case Is = 7
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],4)"
Case Is = 8
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],5)"
Case Is = 9
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],6)"
Case Is = 10
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],7)"
Case Is = 11
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],8)"
Case Is = 12
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],9)"
Case Is = 13
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],10)"
Case Is = 14
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],8)"
Case Is = 15
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],9)"
Case Is = 16
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],10)"
Case Is = 17
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],11)"
Case Is = 20
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],11)"
Case Is = 21
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],15)"
Case Is = 32
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],6)"
Case Is = 42
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],6)"
Case Is = 43
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],6)"
Case Is = 44
Range("D" & pCell.Row).FormulaR1C1 = "= LEFT(RC[-1],6)"
End Select
End If
Next pCell
LR = Range("B1").End(xlDown).Offset(1, 0).Row
End Sub
Bookmarks