Error on textbox entry - Go back to text box

L

Les

Hi all,

I have code that check if the entry in a text box is correct..... this code
is using/in the beforeUpdate Event.

It works great, with the exception of the cursor jumping to the next
textbox, if it is an error i would like the cursor to go back to the textbox
with the error for re-entry.

I am batteling to get this !!!
Any help would be apprciated.
 
C

Charlie

If your code is in the sheet module then

TextBox1.Activate

if your code is in a standard module then

Sheet1.TextBox1.Activate
 
R

RyanH

I would use this.

Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)

If TextBox1.Text <> "test" Then
Cancel = True

' *******your code here*****

End If

End Sub

Hope this helps. If so please click "yes" below.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top