I'm having trouble with the datatype in my code. I converted the 6 to a string but I'm getting the same error. Any suggestions please?
Sub test1()
' Generates batch number based on company code
Dim x As Integer
Dim a As Integer
a = Cells(Rows.Count, 2).End(xlUp).Row
For x = 6 To a
If Cells(x, 2).Value = "US1K" Then
Cells(x, 1).Value = 1
ElseIf Cells(x, 2).Value = "USYB" Then
Cells(x, 1).Value = 2
ElseIf Cells(x, 2).Value = "US1A" Then
Cells(x, 1).Value = 3
ElseIf Cells(x, 2).Value = "US4U" Then
Cells(x, 1).Value = 4
ElseIf Cells(x, 2).Value = "US3D" Then
Cells(x, 1).Value = 5
Else
Cells(x, 1).Value = " "
End If
Next x
End Sub