troubleshooting Question

Add two more worksheet to current code...

Avatar of route217
route217Flag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft Excel
10 Comments1 Solution313 ViewsLast Modified:
Hi Experts

i need to add the following worksheet to function with the vba code below...

1. Payment
2. Telephony...

Sub ToggleVisibilityOfDataWs()

Application.EnableEvents = False

    Const MasterName As String = "Main"
    Const pw As String = "Test1"

        With ThisWorkbook
            If .ActiveSheet.Name = "Main" Then
                With .Worksheets("Source Data")
                    If .Visible Then
                       .Visible = False
                       If InputBox("PLEASE ENTER PASSWORD:", "Password Security Check....") = pw Then
                       .Visible = True
                MsgBox "INCORRECT PASSWORD - PLEASE TRY AGAIN!", vbOKOnly + vbInformation, "Feedback....."
            End If
          End If
         End With
            MsgBox "Can only run this macro from worksheet called " & MasterName, vbOKOnly + vbInformation, "Feedback....."
          End If
        End With
    Application.EnableEvents = True
    ActiveWindow.DisplayWorkbookTabs = True

End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros