graviz
Registered User.
- Local time
- Today, 01:54
- Joined
- Aug 4, 2009
- Messages
- 167
Is there any way to simplify and shorten my code. It works but I feel like I could shorten it somehow.
Function DishNet_Converted_Type(service_code_string As String) As String
Dim CodeArray, i As Integer
NC_CodeArray = Array("60")
CH_CodeArray = Array("64", "74", "8.", "R=")
TC_CodeArray = Array("~R")
For i = 0 To UBound(NC_CodeArray)
If InStr(service_code_string, NC_CodeArray(i)) Then
DishNet_Converted_Type = "NC"
Exit Function
End If
Next
For i = 0 To UBound(CH_CodeArray)
If InStr(service_code_string, CH_CodeArray(i)) Then
DishNet_Converted_Type = "CH"
Exit Function
End If
Next
For i = 0 To UBound(TC_CodeArray)
If InStr(service_code_string, TC_CodeArray(i)) Then
DishNet_Converted_Type = "TC"
Exit Function
End If
Next
DishNet_Converted_Type = "Error"
End Function
Any ideas?
Function DishNet_Converted_Type(service_code_string As String) As String
Dim CodeArray, i As Integer
NC_CodeArray = Array("60")
CH_CodeArray = Array("64", "74", "8.", "R=")
TC_CodeArray = Array("~R")
For i = 0 To UBound(NC_CodeArray)
If InStr(service_code_string, NC_CodeArray(i)) Then
DishNet_Converted_Type = "NC"
Exit Function
End If
Next
For i = 0 To UBound(CH_CodeArray)
If InStr(service_code_string, CH_CodeArray(i)) Then
DishNet_Converted_Type = "CH"
Exit Function
End If
Next
For i = 0 To UBound(TC_CodeArray)
If InStr(service_code_string, TC_CodeArray(i)) Then
DishNet_Converted_Type = "TC"
Exit Function
End If
Next
DishNet_Converted_Type = "Error"
End Function
Any ideas?