Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Strange behavior with text box values . . . help!

I have a strange problem with code that I am running with numerics that I am
puting into text boxes.

I have made a user form that asks my unit supervisors to input two numbers
into two different text boxs. The first box is the number of times that a
task is required. The second box is the number of times that the task was
actually performed.

The code that I attached to the "times done" box checks to see if the user
accidentally switched the values and then offers to switch them back. And all
works fine until . . .

If the user puts in the values of 10 and 9, then the code pops up the
message box saying that the times done is greater than the times required,
even though they are not. If I input 10 and 09, then the code works as
intended.

I am hoping there is a simple solution to this that I have not seen yet.

Will
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Strange behavior with text box values . . . help!

values in a textbox are strings. therefore you get the seemingly wrong
answer.

if clng(textbox2.Value) clng(textbox1.Value) then

Using clng to convert the text numbers to actual numbers should clear up the
problem.

--
Regards,
Tom Ogilvy

"WillRn" wrote in message
...
I have a strange problem with code that I am running with numerics that I

am
puting into text boxes.

I have made a user form that asks my unit supervisors to input two numbers
into two different text boxs. The first box is the number of times that a
task is required. The second box is the number of times that the task was
actually performed.

The code that I attached to the "times done" box checks to see if the user
accidentally switched the values and then offers to switch them back. And

all
works fine until . . .

If the user puts in the values of 10 and 9, then the code pops up the
message box saying that the times done is greater than the times required,
even though they are not. If I input 10 and 09, then the code works as
intended.

I am hoping there is a simple solution to this that I have not seen yet.

Will



Reply
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
Strange behavior Ritchie Excel Discussion (Misc queries) 2 September 26th 06 02:21 AM
Strange behavior DeRussie Setting up and Configuration of Excel 4 November 26th 05 05:41 PM
Strange behavior. Wiley Coyote Excel Discussion (Misc queries) 7 October 18th 05 04:35 PM
Strange behavior w/ Text, Button, & Check Boxes kswinth Excel Discussion (Misc queries) 0 June 26th 05 04:49 PM
Strange behavior Chart.SeriesCollection(n).Values property Emile van Mierlo Excel Programming 3 June 19th 04 06:07 PM


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

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

About Us

"It's about Microsoft Excel"