LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default SetFocus not working

Hi,

I'm doing an invalid entry checking on a textbox, and in the event there's
really an invalid entry, after the MsgBox popped up, I'd like the textbox to
be get focus and its content highlighted.

Everything runs fine except the SetFocus part. No VBA error, it's just that
after the MsgBox, the focus is simply on the next control in my UserForm. The
SetFocus seems to be doing nothing. Could someone help?

code:
--------------------------------------------------------------------------------
Private Sub tbxTotalStoresSales_AfterUpdate()

If IsNumeric(ufInsertSales.tbxTotalStoresSales.Value) = False Then
MsgBox "Invalid Entry! Numeric Values Only. Please try again.", _
vbOKOnly + vbExclamation, "Attention!"
ufInsertSales.tbxTotalStoresSales.SetFocus
ElseIf ufInsertSales.tbxTotalStoresSales.Value < 0 Then
MsgBox "Invalid Entry! Negative Values Unacceptable. _
Please try again.", vbOKOnly + vbExclamation, "Attention!"
ufInsertSales.tbxTotalStoresSales.SetFocus
Else
tbxTotalStoresSales.Value = FormatCurrency(tbxTotalStoresSales.Value)
End If

End Sub
--------------------------------------------------------------------------------

Thank you,

Henry T


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SetFocus testing Tim[_44_] Excel Programming 3 September 7th 05 07:20 PM
Is this right? SetFocus weirdness David Curtis Excel Programming 0 February 24th 05 02:56 PM
setfocus Dean Reardon Excel Programming 2 December 15th 04 12:18 PM
SetFocus Question Sam Excel Programming 2 August 20th 04 04:01 PM
SetFocus Problem Todd Huttenstine[_2_] Excel Programming 2 January 19th 04 10:50 PM


All times are GMT +1. The time now is 11:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"