On Thu, 28 Jul 2005 09:56:08 +0930, "Rob" <NA> wrote:
>Some things I can't get right are:
>I want to restrict the input to numbers only.
I would use the WorksheetFunction ISNUMBER to check that the value is
numeric.. you can use a sub-routine that runs upon exiting the field..
Private Sub LoanTextBox_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Application.WorksheetFunction.IsNumber(txtBox) Then
Exit Sub
Else
MsgBox ("Sorry, please use only numbers")
LoanTextBox.SetFocus
End If
End Sub
Whenever someone leaves this text box, the sub-routine will check to
see if the value is numeric. If it is, it exits the sub-routine.
Otherwise, it gives them a message box that says they must use only
numbers, and sets the focus back into the text box. If they try to
leave again, it will do the same unless they changed their entry to
numeric.
>I want the TextBoxes to be blank and not show a "0" OR have it so that the 0
>amount is highlighted so that when the user clicks in the box it overwrites
>the 0. (When I use "" instead of 0 when resetting the Textboxes to blank I
>get a type missmatch alert.)
LoanTextBox.Value = "" 'Sets them to a null value (blank)
You could also do a sub-routine like the one above to clear it when
they click on it. Set your initial value to "0" and then use this:
Private Sub LoanTextBox_GotFocus()
LoanTextBox.Value = ""
End Sub
That will clear it when they tab to or click on the text box.
MP-
--
"Learning is a behavior that results from consequences."
B.F. Skinner
Bookmarks