ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Userform question (https://www.excelbanter.com/excel-programming/298458-userform-question.html)

David Goodall

Userform question
 
Hello
I've used the following code to validate an entry into a textbox.

Private Sub TextBox1_Change()
Dim number_of_locations As Integer
If TextBox1 = vbNullString Then Exit Sub
If Not IsNumeric(TextBox1) Then
MsgBox "Sorry, numbers only"
TextBox1 = vbNullString
Else
number_of_locations = val(TextBox1.Value)
addlocations (number_of_locations) ' this prompts a second userform to
appear based on the no of locations
Exit Sub

End If
End Sub

The addlocations sub then unloads the first form and the user enter details
in the second userform. After the information is entered I use a cmd button
to reload the first userform. The problem is that the textbox on form 1 does
not react to any changes. I need a way to reset the textbox.

Any help as always greatly appreciated.

David



David Goodall

Userform question
 
Sorry to have troubled anyone but I think I've sorted the problem.
"David Goodall" wrote in message
news:y6Hpc.41$JL5.4@newsfe1-win...
Hello
I've used the following code to validate an entry into a textbox.

Private Sub TextBox1_Change()
Dim number_of_locations As Integer
If TextBox1 = vbNullString Then Exit Sub
If Not IsNumeric(TextBox1) Then
MsgBox "Sorry, numbers only"
TextBox1 = vbNullString
Else
number_of_locations = val(TextBox1.Value)
addlocations (number_of_locations) ' this prompts a second userform

to
appear based on the no of locations
Exit Sub

End If
End Sub

The addlocations sub then unloads the first form and the user enter

details
in the second userform. After the information is entered I use a cmd

button
to reload the first userform. The problem is that the textbox on form 1

does
not react to any changes. I need a way to reset the textbox.

Any help as always greatly appreciated.

David






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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com