mortgageman
Well-known Member
- Joined
- Jun 30, 2005
- Messages
- 2,015
I am having the following problem with a textbox in my userform. The moment that any number is entered, the program starts. This is a problem if the user needs to input a 2 digit number - since the program kicks in as soon as the first digit is entered.
Thanks in advance for any help. Here is the code that I am using.
Gene, "The Mortgage Man", Klein
Private Sub UserGCFTextBox_Change()
Dim num1 As Integer, num2 As Integer, correctgcd As Integer
num1 = Val(TextBoxnumber1.Value)
num2 = Val(TextBoxnumber2.Value)
correctgcd = GCD(num1, num2)
If Val(UserGCFTextBox.Value) = correctgcd Then
RightGCFTextBox.Visible = True
RightGCFTextBox.Value = correctgcd
RightGCFTextBox.BackColor = vbGreen
Else
RightGCFTextBox.Visible = True
RightGCFTextBox.Value = correctgcd
RightGCFTextBox.BackColor = vbRed
End If
End Sub
Thanks in advance for any help. Here is the code that I am using.
Gene, "The Mortgage Man", Klein
Private Sub UserGCFTextBox_Change()
Dim num1 As Integer, num2 As Integer, correctgcd As Integer
num1 = Val(TextBoxnumber1.Value)
num2 = Val(TextBoxnumber2.Value)
correctgcd = GCD(num1, num2)
If Val(UserGCFTextBox.Value) = correctgcd Then
RightGCFTextBox.Visible = True
RightGCFTextBox.Value = correctgcd
RightGCFTextBox.BackColor = vbGreen
Else
RightGCFTextBox.Visible = True
RightGCFTextBox.Value = correctgcd
RightGCFTextBox.BackColor = vbRed
End If
End Sub