Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What I think you're doing....
1. You have a userform you created that has a button or two that checks textboxes where you want folks to entere dates. If they entere dates that are not valid, you pop up a message box to tell them. THE PROBLEM is that once they click thorugh the message box, the form is blanked out or unloaded or you just can't see it. What I think you want to do.... A. Warn them B. Don't dump the form Get rid of the code "call main program" All you need to do is run the code to check if it is a date or not then pop the msgbox. Nothing else. If you don't really care what info they put in there and just want to warn them, highlight the text box when the exit the box. Something like this: Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) If IsDate(TextBox1.Value) = False Then TextBox1.BackColor = &HFF& Else TextBox1.BackColor = &HFFFFFF End If End Sub if you really want to force them to enter the date appropriately, (assuming you have a final button or routine they click to save their entry....) just enter a snip of code in the routine that goes something like this... sub savebutton_click() Dim DateFlag As Boolean If IsDate(TextBox1.Value) = False Then DateFlag = True If IsDate(TextBox2.Value) = False Then DateFlag = True If IsDate(TextBox3.Value) = False Then DateFlag = True If DateFlag = True Then MsgBox "You need to enter the right date in the red boxes": Exit Sub End If end sub ===== Regards, Jamie |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Userform to enter values and shown in same userform in list | Excel Programming | |||
Looping procedure calls userform; how to exit loop (via userform button)? | Excel Programming | |||
Activating userform and filling it with data form row where userform is activate | Excel Programming | |||
Access from add_in userform to main template userform.... | Excel Programming | |||
Linking userform to userform in Excel 2003 | Excel Programming |