Hi,
I want to modify the function in the code below to test 2 variables instead of just the 1.
So, as an example, in the first IF statement, the string looks for "CAMP MIRAGE BASED UNITS/TACTICAL AIRLIFT UNIT" and if found it returns "A - CM - TAU".
I would like this IF statement to look for "CAMP MIRAGE BASED UNITS/TACTICAL AIRLIFT UNIT" and a date in the same row (column N) (example 02 Sep 2009) before giving it's return.
Function findCode(strIn As String) As String
If InStr(strIn, "CAMP MIRAGE BASED UNITS/TACTICAL AIRLIFT UNIT") > 0 Then
findCode = "A – CM – TAU"
Exit Function
End If
If InStr(strIn, "CAMP MIRAGE BASED UNITS/THEATRE SUPPORT ELEMENT") > 0 Then
findCode = "B – CM TSE"
Exit Function
End If
If InStr(strIn, "KABUL and OTHER LOCATION UNITS/MISC HQ and STAFFS") > 0 Then
findCode = "C – MISC HQ & STAFF"
Exit Function
End If
If InStr(strIn, "KABUL and OTHER LOCATION UNITS/SLTC – A") > 0 Then
findCode = "Nothins specified"
Exit Function
End If
If InStr(strIn, "KANDAHAR BASED UNITS/ASIC") > 0 Then
findCode = "D – ASIC"
Exit Function
End If
If InStr(strIn, "KANDAHAR BASED UNITS/AVN COY") > 0 Then
findCode = "Nothins specified"
Exit Function
End If
If InStr(strIn, "KANDAHAR BASED UNITS/ENGR SUPPORT UNIT") > 0 Then
findCode = "E – ENGR SP"
Exit Function
End If
If InStr(strIn, "KANDAHAR BASED UNITS/HSS UNIT") > 0 Then
findCode = "F – HSS"
Exit Function
End If
If InStr(strIn, "KANDAHAR BASED UNITS/INF BG") > 0 Then
findCode = "G – INF BG"
Exit Function
End If
If InStr(strIn, "KANDAHAR BASED UNITS/JTF AFG HQ") > 0 Then
findCode = "H – JTF AFG HQ BLK 1"
Exit Function
End If
If InStr(strIn, "KANDAHAR BASED UNITS/MP COY") > 0 Then
findCode = "I – MP COY"
Exit Function
End If
If InStr(strIn, "KANDAHAR BASED UNITS/NSE") > 0 Then
findCode = "J – NSE"
Exit Function
End If
If InStr(strIn, "KANDAHAR BASED UNITS/OMLT") > 0 Then
findCode = "K – OMLT"
Exit Function
End If
If InStr(strIn, "KANDAHAR BASED UNITS/PRT") > 0 Then
findCode = "L – PRT"
Else
findCode = "No Code Specified"
End If
End Function
Thank You
TB
Bookmarks