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: 15
Default Setfocus Problem

Hi there....
I am trying to clear and setfocus to textbox1 after I enter a number!
I must be setting the controls wrong because I can't get textbox1 to accept
focus without hitting enter twice.
Here is the sample code below... please help!

Option Explicit

Private Sub TextBox1_AfterUpdate()
Dim varOne As Long
Dim varTwo As Long
Dim varTotal As Long
If TextBox1.Value < "" And TextBox1 < 0 Then
varOne = TextBox1.Value
varTwo = TextBox2.Value
varTotal = varOne + varTwo
TextBox2.Value = Format(varTotal, "Standard")
TextBox1.Value = ""
TextBox1.SetFocus
Else
TextBox1.Value = ""
TextBox1.SetFocus
End If
End Sub
Private Sub UserForm_Activate()
TextBox1.Value = ""
TextBox2.Value = Format(0, "Standard")
End Sub


Thanks
Craig


 
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 problem cesw Excel Programming 1 September 10th 05 08:19 PM
SetFocus problem JH Excel Programming 1 April 18th 05 03:55 PM
SetFocus Problem Todd Huttenstine[_2_] Excel Programming 2 January 19th 04 10:50 PM
TextBox SetFocus Problem Tom Ogilvy Excel Programming 1 September 12th 03 01:27 PM
SetFocus problem RFraley Excel Programming 2 September 7th 03 01:18 PM


All times are GMT +1. The time now is 05:42 PM.

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"