Hi
I'm trying to use VBA to work out what type of vehicle is supposed to be in a diagram.
So, for example:
AB1XX = Class 1
AB5XX, 6XX, 7XX = Class 2
BC 11X = Class 3
BC 12X = Class 4
CD 23X, 24X = Class 5.
I'm currently trying to use a Select Case statement, but the following doesn't work:
Is there a neater way of doing this? There are many diagrams, so I don't really want to have to do too many select/case statements. What I really want to do is check within a range if possible.
Thanks
Chris
I'm trying to use VBA to work out what type of vehicle is supposed to be in a diagram.
So, for example:
AB1XX = Class 1
AB5XX, 6XX, 7XX = Class 2
BC 11X = Class 3
BC 12X = Class 4
CD 23X, 24X = Class 5.
I'm currently trying to use a Select Case statement, but the following doesn't work:
Code:
Function getClass(strDiagram As String)
Select Case strDiagram
Case Left(strDiagram, 3) = "NH4"
getClass = "150"
Case Left(strDiagram, 3) = "NH3"
getClass = "156"
Case Else
getClass = Left(strDiagram, 3)
End Select
End Function
Is there a neater way of doing this? There are many diagrams, so I don't really want to have to do too many select/case statements. What I really want to do is check within a range if possible.
Thanks
Chris