T
theseandavis
Hey guys,
I dont know much about VBA and programming, so this may be a dumb
question
I have a custom function I created here in VBA and I need to add some
conditionality to it. Here is the part of the code I would like to
manipulate:
**************
Public Function NextInspection(SinceLastInspection, SinceLastM3,
ObjectClass, ObjectCat) As String
Dim KM As Variant
Dim CycleNumber As Integer
KM = SinceLastM3 - SinceLastInspection + 6000
CycleNumber = Round(KM / 6000, 0)
If ObjectClass = "TROL" Then
Select Case CycleNumber
Case 1 To 8: NextInspection = "MINOR-T"
Case 9: NextInspection = "MAJOR3-T"
Case Else: NextInspection = "INVALID NEST-CHECK DETAIL"
End Select
.....
******************
What I would like to tell this to do is, for every time that
CycleNumber exceeds 9, subtract 9 (eg.9 is the max, but may potentially
exceed 9, so if it were to read 10 i would like it to instead read '1'
and return "MINOR-T")
Ive tried adding it in with my own knowledge, but I dont know how to do
it and keep getting errors. Any help is appreciated!
I dont know much about VBA and programming, so this may be a dumb
question
I have a custom function I created here in VBA and I need to add some
conditionality to it. Here is the part of the code I would like to
manipulate:
**************
Public Function NextInspection(SinceLastInspection, SinceLastM3,
ObjectClass, ObjectCat) As String
Dim KM As Variant
Dim CycleNumber As Integer
KM = SinceLastM3 - SinceLastInspection + 6000
CycleNumber = Round(KM / 6000, 0)
If ObjectClass = "TROL" Then
Select Case CycleNumber
Case 1 To 8: NextInspection = "MINOR-T"
Case 9: NextInspection = "MAJOR3-T"
Case Else: NextInspection = "INVALID NEST-CHECK DETAIL"
End Select
.....
******************
What I would like to tell this to do is, for every time that
CycleNumber exceeds 9, subtract 9 (eg.9 is the max, but may potentially
exceed 9, so if it were to read 10 i would like it to instead read '1'
and return "MINOR-T")
Ive tried adding it in with my own knowledge, but I dont know how to do
it and keep getting errors. Any help is appreciated!