ValerieT
07-28-2014, 04:54 AM
Hello
I am learning to create function. As you can see, the 2 below are identical twins. I am sure I could use an optional parameter to have 1 function only? (example: Optional parameter "M" would return the GetMissCol part, Optional parameter "L" would return the GetLastCol part)
but I can't make it work
Public Function GetMissCol()
GetCol
Dim MyFind As String
MyRes = 0
list = Split(AllConst, ";")
For i = 0 To UBound(list)
MyFind = list(i)
If GetConst(MyFind) = 0 Then
MyRes = MyRes & MyFind & "; "
End If
Next i
If MyRes = 0 Then
MyRes = "Everything is OK"
End If
GetMissCol = MyRes
End Function
Public Function GetLastCol()
GetCol
Dim MyFind As String
MyRes = 0
list = Split(AllConst, ";")
For i = 0 To UBound(list)
MyFind = list(i)
If GetConst(MyFind) > MyRes Then
MyRes = GetConst(MyFind)
End If
Next i
GetLastCol = MyRes
End Function
I am learning to create function. As you can see, the 2 below are identical twins. I am sure I could use an optional parameter to have 1 function only? (example: Optional parameter "M" would return the GetMissCol part, Optional parameter "L" would return the GetLastCol part)
but I can't make it work
Public Function GetMissCol()
GetCol
Dim MyFind As String
MyRes = 0
list = Split(AllConst, ";")
For i = 0 To UBound(list)
MyFind = list(i)
If GetConst(MyFind) = 0 Then
MyRes = MyRes & MyFind & "; "
End If
Next i
If MyRes = 0 Then
MyRes = "Everything is OK"
End If
GetMissCol = MyRes
End Function
Public Function GetLastCol()
GetCol
Dim MyFind As String
MyRes = 0
list = Split(AllConst, ";")
For i = 0 To UBound(list)
MyFind = list(i)
If GetConst(MyFind) > MyRes Then
MyRes = GetConst(MyFind)
End If
Next i
GetLastCol = MyRes
End Function