PC Review


Reply
Thread Tools Rate Thread

Compare Userform inputs

 
 
New Member
Join Date: Aug 2010
Posts: 1
 
      16th Aug 2010
I need to compare two user inputs. If the second input is greater than the first, I want an error box to pop up and for it to clear out the input boxes forcing the user to input different values. This is the code I am trying to use right now. It's odd because if I input 10000 and 1000 in the boxes the code works, but if I input 10000 and 2000 it doesn't work. The error box pops up even though 2000 is not greater than 10000


Private Sub TextBox2_Change()
Dim answer As String

With TextBox2


If TextBox2.Value > TextBox1.Value Then

answer = MsgBox("The 2nd input can not be greater than the 1st input" & vbNewLine & "Please modify your input", vbOKOnly + vbCritical, "ERROR")
TextBox1.Value = ""
TextBox2.Value = ""
End If


End With
End Sub

thanks!!
CMS
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help selecting a range in vba from userform inputs grievesy Microsoft Excel Programming 3 27th Apr 2006 10:28 PM
Automated userform inputs to the spreadsheet =?Utf-8?B?RGFu?= Microsoft Excel Programming 2 11th Jun 2004 04:54 PM
Automated userform inputs to the spreadsheet =?Utf-8?B?RGFu?= Microsoft Excel Programming 1 11th Jun 2004 04:54 PM
userform inputs Jo Microsoft Excel Programming 1 19th Sep 2003 11:36 PM
Re: userform inputs Jouni Microsoft Excel Programming 0 19th Sep 2003 10:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:43 PM.