Code problem with text box
I have a user form with a text box. The user enters a rate and a return on
assets figure is calculated. My problem is that when the rate is blank, if
the user zeroes it out, an overflow error occurs. I think this is due to the
fact that when it's blank a division by zero is performed downstream. I tried
to write some code to deal with this but it doesn't seem to work. Any help
would be appreciated.
Private Sub txtvolsp_Change()
If txtvolsp.Text = " " Then
spvol = 0.00001
Else
spvol = CLng(txtvolsp.Value)
End If
End Sub
--
Paul
|