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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,224,828
Messages
6,181,201
Members
453,022
Latest member
RobertV1609

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