LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text format - setting text colour with code NDBC Excel Discussion (Misc queries) 6 July 1st 09 10:15 PM
Macro - Fixed text code needs replacing with variable text steven.holloway Excel Discussion (Misc queries) 3 July 22nd 08 03:57 PM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
Problem with VBA Code? Steve[_71_] Excel Programming 7 November 1st 04 03:39 PM
Date problem from code to text box to spreadsheet Joe 90[_2_] Excel Programming 2 October 20th 03 11:18 PM


All times are GMT +1. The time now is 11:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"