Hello All,
I am trying to convert a function into a sub procedure. The function below works great, but for me it would be real use if I could use as a Sub procedure.
Basically, I would want to select the range and if after the decimal if its not rounded to 2 numbers then I would want to highlight.
Basically something like this:
1.2 <- highlight cell
1.20 <- do not highlight the cell
1.3232 <- highlight the cell
Function GetNumberDecimalPlaces(theCell As Range) As Integer
Dim periodPlace As Integer, stringLength As Integer
periodPlace = InStr(1, theCell.Text, ".")
If periodPlace = 0 Then
GetNumberDecimalPlaces = 0
Else
stringLength = Len(theCell.Text)
GetNumberDecimalPlaces = stringLength - periodPlace
End If
End Function
Any help would be great.
Thanks in advance.
I am trying to convert a function into a sub procedure. The function below works great, but for me it would be real use if I could use as a Sub procedure.
Basically, I would want to select the range and if after the decimal if its not rounded to 2 numbers then I would want to highlight.
Basically something like this:
1.2 <- highlight cell
1.20 <- do not highlight the cell
1.3232 <- highlight the cell
Function GetNumberDecimalPlaces(theCell As Range) As Integer
Dim periodPlace As Integer, stringLength As Integer
periodPlace = InStr(1, theCell.Text, ".")
If periodPlace = 0 Then
GetNumberDecimalPlaces = 0
Else
stringLength = Len(theCell.Text)
GetNumberDecimalPlaces = stringLength - periodPlace
End If
End Function
Any help would be great.
Thanks in advance.