**CORRECTION** The problems listed below only happens for certain users. Maybe different versions of excel?
I have two macros that are supposed to run upon clicking a CommandButton.
First, there are several cells that either contain "YES" or "NO"
If the cell equals "YES", the corresponding sheet should be active, otherwise it should be hidden.
Second, the other macro will send an email to everybody on the email list.
In order to complete both of these actions, I have the following code. The CommandButton asks the user to verify that they saved the file to a certain folder and if the answer is yes, it's supposed to complete the above two macros.
However, it does not seem to be working for the first part (i.e. the sheets are staying active even when the cell contains "NO").
Please let me know if you need more information.
I have two macros that are supposed to run upon clicking a CommandButton.
First, there are several cells that either contain "YES" or "NO"
If the cell equals "YES", the corresponding sheet should be active, otherwise it should be hidden.
Second, the other macro will send an email to everybody on the email list.
In order to complete both of these actions, I have the following code. The CommandButton asks the user to verify that they saved the file to a certain folder and if the answer is yes, it's supposed to complete the above two macros.
However, it does not seem to be working for the first part (i.e. the sheets are staying active even when the cell contains "NO").
Please let me know if you need more information.
Code:
Private Sub CommandButton1_Click()
Dim Msg As String, Ans As Variant
Msg = "Have you saved this file to the NPI working folder?"
Ans = MsgBox(Msg, vbYesNo)
Select Case Ans
Case vbYes 'If answer is yes then continue
Call Vis
Call Contact
Worksheets("Cover").Activate
Case vbNo 'If answer is no, display message
Dim Msg1 As String
Msg1 = MsgBox("Save this file to the NPI Working Folder and then continue")
GoTo Quit:
End Select
Quit:
End Sub
Last edited: