Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Function basTrunc(MyVal As Variant, _
Optional DelimChr As String = ".", _
Optional NChar As Integer = 2)
'Michael Red 6/5/2003 Tek-Tips thread222-567798 for pkailas
'Sample Usage:
'? basTrunc(3.1284)
' 3.12
'? basTrunc("Michael Lee Red", " ", 0)
'Michael
Dim MyStr As String
Dim MyParts() As String
Dim rtnVal As Variant
If (IsNumeric(MyVal)) Then
MyStr = CStr(MyVal)
Else
MyStr = MyVal
End If
MyParts = Split(MyStr, DelimChr)
rtnVal = MyParts(0) & DelimChr & Left(MyParts(1), NChar)
If (IsNumeric(MyVal)) Then
basTrunc = CDbl(rtnVal)
Else
basTrunc = rtnVal
End If
End Function