Closing UserForm with Timer (userform shows on IF statement)

RMXByker

New Member
Joined
Apr 1, 2010
Messages
38
Have one more question for a unique setup. I know that my code is very much not efficient, but I understand it and thats important to me. Here is what I'm trying to do. When the user clicks the CommandButton1, Excel verifies each textbox has information in it. If so, the last step is to check and see if the one box has "LAT" written in it. If so, it will pop open another userform which is just used as an informational popup. I would like this one to be timed. I have tried, but my lack of vba knowledge if hindering my ability to get this to function like I'd like. Any help would be appreciated.

Code:
Private Sub CommandButton1_Click()

Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Test Plan")


With ws


ActiveSheet.Unprotect Password:="TEST"
    
  .Range("c3") = Me.Description.Value
  .Range("i3") = Me.RespEngAppr.Value
  .Range("l3") = Me.EngPhone.Value
  .Range("bz1") = Me.TestEng.Value
  .Range("bz2") = Me.ProjectNo.Value
  .Range("bz3") = Me.AltContact.Value
  .Range("bz4") = Me.AltPhone.Value
  .Range("bz8") = Me.DueDate.Value
  .Range("U8") = Me.TONo.Value
  
  .Range("D1").Value = ComboBox1.Value
    
'Coding for error message to pop up for lack of inputted data
  
        If Me.TONo.Value = "" Then
         
           MsgBox "You must complete the TO No field before Inputting Data", vbCritical
           ActiveSheet.Protect Password:="TEST", AllowInsertingRows:=True, AllowDeletingRows:=True
           Exit Sub
                    
         End If
         
        If Me.ComboBox1.Value = "" Then
         
           MsgBox "You must complete the Test Type field before Inputting Data", vbCritical
           ActiveSheet.Protect Password:="TEST", AllowInsertingRows:=True, AllowDeletingRows:=True
           Exit Sub
                    
         End If
         
        If Me.Description.Value = "" Then
         
           MsgBox "You must complete the Description field before Inputting Data", vbCritical
           ActiveSheet.Protect Password:="TEST", AllowInsertingRows:=True, AllowDeletingRows:=True
           Exit Sub
                    
         End If
         
        If Me.RespEngAppr.Value = "" Then
         
           MsgBox "You must complete the Responsible Engineer field before Inputting Data", vbCritical
           ActiveSheet.Protect Password:="TEST", AllowInsertingRows:=True, AllowDeletingRows:=True
           Exit Sub
                    
         End If
         
        If Me.EngPhone.Value = "" Then
         
           MsgBox "You must complete the Engineer Phone field before Inputting Data", vbCritical
           ActiveSheet.Protect Password:="TEST", AllowInsertingRows:=True, AllowDeletingRows:=True
           Exit Sub
                    
         End If
         
        If Me.TestEng.Value = "" Then
         
           MsgBox "You must complete the Test Engineer field before Inputting Data", vbCritical
           ActiveSheet.Protect Password:="TEST", AllowInsertingRows:=True, AllowDeletingRows:=True
           Exit Sub
                    
         End If
         
        If Me.ProjectNo.Value = "" Then
         
           MsgBox "You must complete the Project No. field before Inputting Data", vbCritical
           ActiveSheet.Protect Password:="TEST", AllowInsertingRows:=True, AllowDeletingRows:=True
           Exit Sub
                    
         End If
                
        If Me.AltContact.Value = "" Then
         
           MsgBox "You must complete the Alternate Contact field before Inputting Data", vbCritical
           ActiveSheet.Protect Password:="TEST", AllowInsertingRows:=True, AllowDeletingRows:=True
           Exit Sub
                    
         End If
         
        If Me.AltPhone.Value = "" Then
         
           MsgBox "You must complete the Alternate Contact Phone field before Inputting Data", vbCritical
           ActiveSheet.Protect Password:="TEST", AllowInsertingRows:=True, AllowDeletingRows:=True
           Exit Sub
                    
         End If
         
        If Me.DueDate.Value = "" Then
         
           MsgBox "You must complete the Due Date field before Inputting Data", vbCritical
           ActiveSheet.Protect Password:="TEST", AllowInsertingRows:=True, AllowDeletingRows:=True
           Exit Sub
                    
         End If
        
        If Me.ComboBox1.Value = "LAT" Then


           LAT_Notice.Show
           Application.Wait (Now + TimeValue("00:00:02"))
        
           Exit Sub
           
        End If
  
' End of Coding for error message to pop up for lack of inputted data
  
  ActiveSheet.Protect Password:="TEST", AllowInsertingRows:=True, AllowDeletingRows:=True
    
End With


End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top