Function IsLetter(strValue As String) As Boolean
Dim intPos As Integer
For intPos = 1 To Len(strValue)
Select Case Asc(Mid(strValue, intPos, 1))
Case 65 To 90, 97 To 122
IsLetter = True
Case Else
IsLetter = False
Exit For
End Select
Next
End Function
Sub Button1_Click()
Dim pos1 As String, pos2 As Variant, pos3 As Variant, pos4 As String, pos5 As Variant
Dim pos6 As Variant, pos7 As Variant, pos8 As Variant, pos9 As Variant, pos10 As Variant
Dim pos11 As Variant, pos12 As Variant, pos13 As Variant, pos14 As Variant, pos15 As Variant
Dim numCheck1 As Boolean, numCheck2 As Boolean, numCheck3 As Boolean, numCheck4 As Boolean, numCheck5 As Boolean
Dim numCheck6 As Boolean, numCheck7 As Boolean, numCheck8 As Boolean, numCheck9 As Boolean, numCheck10 As Boolean
Dim numCheck11 As Boolean, numCheck12 As Boolean, numCheck13 As Boolean, numCheck14 As Boolean, numCheck15 As Boolean
Dim letterCheck1 As Boolean, letterCheck2 As Boolean, letterCheck3 As Boolean, letterCheck4 As Boolean, letterCheck5 As Boolean
Dim letterCheck6 As Boolean, letterCheck7 As Boolean, letterCheck8 As Boolean, letterCheck9 As Boolean, letterCheck10 As Boolean
Dim letterCheck11 As Boolean, letterCheck12 As Boolean, letterCheck13 As Boolean, letterCheck14 As Boolean, letterCheck15 As Boolean
'' pos1 = Worksheets("Long").Cells(M5): pos2 = Worksheets("Long").Range(N5).Value: pos3 = Worksheets("Long").Range(O5).Value
pos4 = Worksheets("Long").Cells(P5).Value: Worksheets("Long").Range(Q5).Value: pos6 = Worksheets("Long").Range(R5).Value
pos7 = Worksheets("Long").Range(S5).Value: Worksheets("Long").Range(T5).Value: pos9 = Worksheets("Long").Range(U5).Value
pos10 = Worksheets("Long").Range(V5).Value: Worksheets("Long").Range(W5).Value: pos12 = Worksheets("Long").Range(X5).Value
pos13 = Worksheets("Long").Range(Y5).Value: Worksheets("Long").Range(Z5).Value: pos15 = Worksheets("Long").Range(AA5).Value
numCheck1 = IsNumeric(pos1)
numCheck2 = IsNumeric(pos2)
numCheck3 = IsNumeric(pos3)
numCheck4 = IsNumeric(pos4)
numCheck5 = IsNumeric(pos5)
numCheck6 = IsNumeric(pos6)
numCheck7 = IsNumeric(pos7)
numCheck8 = IsNumeric(pos8)
numCheck9 = IsNumeric(pos9)
numCheck10 = IsNumeric(pos10)
numCheck11 = IsNumeric(pos11)
numCheck12 = IsNumeric(pos12)
numCheck13 = IsNumeric(pos13)
numCheck14 = IsNumeric(pos14)
numCheck15 = IsNumeric(pos15)
letterCheck1 = IsLetter(pos1)
letterCheck2 = IsLetter(pos2)
letterCheck3 = IsLetter(pos3)
letterCheck4 = IsLetter(pos4)
letterCheck5 = IsLetter(pos5)
letterCheck6 = IsLetter(pos6)
letterCheck7 = IsLetter(pos7)
letterCheck8 = IsLetter(pos8)
letterCheck9 = IsLetter(pos9)
letterCheck10 = IsLetter(pos10)
letterCheck11 = IsLetter(pos11)
letterCheck12 = IsLetter(pos12)
letterCheck13 = IsLetter(pos13)
letterCheck14 = IsLetter(pos14)
letterCheck15 = IsLetter(pos15)
'Small Business Service Center'
'3 letter, 8 number, with one character that can be skipped as an erroneous space and still generate correct value'
If letterCheck1 = True And letterCheck2 = True And letterCheck3 = True And pos4 = "" And pos13 = "" And pos14 = "" And pos15 = "" Then
Worksheets("Long").Range("A47:I49").Select
'3 letter, 7 number, with one character that can be skipped as an erroneous space and still generate correct value'
ElseIf letterCheck1 = True And letterCheck2 = True And letterCheck3 = True And pos4 = "" And pos12 = "" And pos13 = "" And pos14 = "" And pos15 = "" Then
Worksheets("Long").Range("A47:I49").Select
'2 letter, 8 number, with one character that can be skipped as an erroneous space and still generate correct value'
ElseIf letterCheck1 = True And letterCheck2 = True And pos3 = "" And pos12 = "" And pos13 = "" And pos14 = "" And pos15 = "" Then
Worksheets("Long").Range("A47:I49").Select
'2 letter, 7 number, with one character that can be skipped as an erroneous space and still generate correct value'
ElseIf letterCheck1 = True And letterCheck2 = True And pos3 = "" And pos11 = "" And pos12 = "" And pos13 = "" And pos14 = "" And pos15 = "" Then
Worksheets("Long").Range("A47:I49").Select
'3 letter, 8 number'
ElseIf letterCheck1 = True And letterCheck2 = True And letterCheck3 = True And letterCheck5 = False And pos12 = "" And pos13 = "" And pos14 = "" And pos15 = "" Then
Worksheets("Long").Range("A47:I49").Select
'3 letter, 7 number'
ElseIf letterCheck1 = True And letterCheck2 = True And letterCheck3 = True And letterCheck5 = False And pos11 = "" And pos12 = "" And pos13 = "" And pos14 = "" And pos15 = "" Then
Worksheets("Long").Range("A47:I49").Select
'2 letter, 8 number'
ElseIf letterCheck1 = True And letterCheck2 = True And letterCheck5 = False And pos11 = "" And pos12 = "" And pos13 = "" And pos14 = "" And pos15 = "" Then
Worksheets("Long").Range("A47:I49").Select
'2 letter, 7 number'
ElseIf letterCheck1 = True And letterCheck2 = True And letterCheck5 = False And pos10 = "" And pos11 = "" And pos12 = "" And pos13 = "" And pos14 = "" And pos15 = "" Then
Worksheets("Long").Range("A47:I49").Select
'Legacy Safeco Commercial'
ElseIf numCheck1 = True And numCheck2 = True And letterCheck3 = True And letterCheck4 = True Then
Worksheets("Long").Range("A50:I52").Select
ElseIf numCheck1 = True And numCheck2 = True And pos3 = "-" And letterCheck4 = True And letterCheck5 = True Then
Worksheets("Long").Range("A50:I52").Select
'Middle Markets'
ElseIf pos4 = "Z" Then
Worksheets("Long").Range("A55:I55").Select
ElseIf pos4 = "1" And pos6 <> "C" And pos6 <> "c" Then
Worksheets("Long").Range("A53:I55").Select
'National Markets'
ElseIf pos4 = "6" Then
Worksheets("Long").Range("A56:I58").Select
ElseIf pos4 = "L" And pos6 = "L" Then
Worksheets("Long").Range("A56:I58").Select
ElseIf pos4 = "l" And pos6 = "l" Then
Worksheets("Long").Range("A56:I58").Select
'Involuntary Markets'
ElseIf pos6 = "S" Or pos6 = "s" Then
Worksheets("Long").Range("A59:I61").Select
'Liberty International Underwriters'
'Long LIU policy numbers with beginning letters and ending with numbers'
ElseIf numCheck13 = True And pos14 = "" And pos15 = "" Then
Worksheets("Long").Range("A62:I64").Select
'Short LIU that looks like SBSC numbers with an erroneous space'
ElseIf letterCheck1 = True And letterCheck2 = True And letterCheck3 = True And pos4 = "" And pos12 = "" Then
Worksheets("Long").Range("A62:I64").Select
'Short LIU that looks like SBSC numbers'
ElseIf letterCheck1 = True And letterCheck2 = True And letterCheck3 = True And pos11 = "" Then
Worksheets("Long").Range("A62:I64").Select
'Liberty Canada
ElseIf pos1 = "A" Or pos1 = "a" Then
If pos2 = "C" Or pos2 = "H" Or pos2 = "K" Or pos2 = "L" Or pos2 = "N" Or pos2 = "P" Or pos2 = "Q" Or pos2 = "R" Or pos2 = "X" Or pos2 = "Y" Or pos2 = "Z" Or pos2 = "c" Or pos2 = "k" Or pos2 = "l" Or pos2 = "n" Or pos2 = "p" Or pos2 = "q" Or pos2 = "r" Or pos2 = "x" Or pos2 = "y" Or pos2 = "z" Then
Worksheets("Long").Range("A65:I67").Select
End If
ElseIf pos3 = "T" Or pos3 = "t" Or pos3 = "Q" Or pos3 = "q" Then
If pos4 = "O" Or pos4 = "o" Or pos4 = "U" Or pos2 = "u" Then
Worksheets("Long").Range("A65:I67").Select
End If
' ElseIf pos3 = "T" And pos4 = "O" Then
' Worksheets("Long").Range("A65:I67").Select
' ElseIf pos3 = "t" And pos4 = "o" Then
' Worksheets("Long").Range("A65:I67").Select
' ElseIf pos3 = "Q" And pos4 = "U" Then
' Worksheets("Long").Range("A65:I67").Select
' ElseIf pos3 = "q" And pos4 = "u" Then
' Worksheets("Long").Range("A65:I67").Select
'Liberty Northwest
'LNW Containing "NC"
ElseIf pos5 = "n" And pos6 = "c" Then
Worksheets("Long").Range("A68:I70").Select
ElseIf pos5 = "n" And pos6 = "C" Then
Worksheets("Long").Range("A68:I70").Select
ElseIf pos5 = "N" And pos6 = "c" Then
Worksheets("Long").Range("A68:I70").Select
ElseIf pos5 = "N" And pos6 = "C" Then
Worksheets("Long").Range("A68:I70").Select
'LNW Similar to SBSC
'3 letter, a space, and 6 numbers
ElseIf letterCheck1 = True And letterCheck2 = True And letterCheck3 = True And pos4 = "" And pos11 = "" Then
Worksheets("Long").Range("A68:I70").Select
'3 letter, 6 number'
ElseIf letterCheck1 = True And letterCheck2 = True And letterCheck3 = True And numCheck4 = True And pos10 = "" Then
Worksheets("Long").Range("A68:I70").Select
'Liberty Life Assurance
'8#, a space, and 2 letters and a number
ElseIf numCheck1 = True And numCheck2 = True And numCheck3 = True And numCheck4 = True And numCheck5 = True And numCheck6 = True And numCheck7 = True And numCheck8 = True And pos9 = "" And letterCheck10 = True And letterCheck11 = True And pos12 = "3" Then
Worksheets("Long").Range("A71:I73").Select
'8#, 2 letters and a number
ElseIf numCheck1 = True And numCheck2 = True And numCheck3 = True And numCheck4 = True And numCheck5 = True And numCheck6 = True And numCheck7 = True And numCheck8 = True And letterCheck9 = True And letterCheck10 = True And pos11 = "3" Then
Worksheets("Long").Range("A71:I73").Select
'2 letters, a number, a space, 8 numbers - ending in 3'
ElseIf letterCheck1 = True And letterCheck2 = True And numCheck3 = True And pos4 = "" And pos13 = "3" Then
Worksheets("Long").Range("A71:I73").Select
'2 letters, a number, 8 numbers - ending in 3'
ElseIf letterCheck1 = True And letterCheck2 = True And numCheck3 = True And pos13 = "3" Then
Worksheets("Long").Range("A71:I73").Select
'If what is put in does not fit any of the formatting rules
Else
MsgBox "You Might Be on Your Own. Review the policy formatting sheet for specialty departments. Last resort: Transfer to 800-845-4075"
'End Help Button
End If
End Sub
Bookmarks