Home |
Search |
Today's Posts |
#1
![]()
Posted to comp.apps.spreadsheets,microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hello,
I wonder if someone can help me with this: I'm trying to confirm a valid time entry in a form field, and if invalid, clear the entry and put the focus back in that field. If I use the following code it does work (not the best method, no doubt), but if I remove the UserForm1.Hide and UserForm1.Show lines, the focus always moves to the next field. I know I'm missing something basic here, not sure what. Thanks, Dave If Private Sub txtTime1_Exit(ByVal Cancel As MSForms.ReturnBoolean) On Error GoTo BadTime Dim X txtTime1.Text = Format(Val(txtTime1.Text), "00:00") X = TimeValue(txtTime1.Text) Exit Sub BadTime: UserForm1.Hide MsgBox ("Invalid time") txtTime1.Text = "" txtTime1.SetFocus UserForm1.Show End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
focus | Excel Discussion (Misc queries) | |||
set focus | Excel Discussion (Misc queries) | |||
RTD Getting The Focus | Excel Programming | |||
focus | Excel Programming | |||
focus? | Excel Programming |