***RESOLVED*** Data type conversion error
I need to be able to divide two currency values in an MSFlexGrid to come up with a percent value.
The challenge is that I need to have error handling to be sure that if the user puts in a $.0 currency value I do not get an error.
Ex.
Private Sub MSFlexGrid1_LeaveCell()
With MSFlexGrid1
.TextMatrix(1, 1) = Format(.TextMatrix(2, 1) / .TextMatrix(3, 1), "0.0%")
End With
End Sub
Re: Data type conversion error
Quote:
Originally posted by Jefftopia
I need to be able to divide two currency values in an MSFlexGrid to come up with a percent value.
The challenge is that I need to have error handling to be sure that if the user puts in a $.0 currency value I do not get an error.
Ex.
Private Sub MSFlexGrid1_LeaveCell()
Code:
With MSFlexGrid1
if .textMatrix(3,1) > 0 And .textMatrix(2,1) > 0 then
.TextMatrix(1, 1) = Format(.TextMatrix(2, 1) / .TextMatrix(3, 1), "0.0%")
End
End With
End Sub
You may need to convert the values to decimals...