I have the following code:
$0 is sitting in the TextBox before any user input. Assume the user keys in 30000000
I would like the contents of the TextBox (now showing a $0) to be entirely highlighted. However, the cursor is blinking to the right of $0.
1. What do I change to make the entire contents be selected/highlighted? Or does it not work on formatted numbers?
2. Since a $0 appears in the TextBox after someone keys in 30000000, I am assuming the line "TextBox8=0" Refires the BeforeUpdate event. Correct?
thanks for looking -- I am still learning this stuff
Code:
Private Sub TextBox8_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
If Val(TextBox8) > 25000000 Then
MsgBox ("This box does not support entries greater than $25,000,000."), vbInformation
TextBox8.SelStart = 0
TextBox8.SelLength = Len(TextBox8.Text)
TextBox8 = 0
Cancel = True
End If
TextBox8.Value = Format(TextBox8.Value, "$###,###,##0")
End Sub
I would like the contents of the TextBox (now showing a $0) to be entirely highlighted. However, the cursor is blinking to the right of $0.
1. What do I change to make the entire contents be selected/highlighted? Or does it not work on formatted numbers?
2. Since a $0 appears in the TextBox after someone keys in 30000000, I am assuming the line "TextBox8=0" Refires the BeforeUpdate event. Correct?
thanks for looking -- I am still learning this stuff
Last edited: