+ Reply to Thread
Results 1 to 6 of 6

Help to Unhide a Worksheet based on IfMsgBox responses.

  1. #1
    Registered User
    Join Date
    12-06-2017
    Location
    Oklahoma City, OK
    MS-Off Ver
    MS Office 365
    Posts
    28

    Help to Unhide a Worksheet based on IfMsgBox responses.

    I've tried several options to get the worksheet to unhide and have been unsuccessful. I can get the message box responses to work, and direct to the wanted worksheet when not hidden though.

    Here's my last attempt:
    ------------------
    Private Sub CommandButton1_Click()
    If MsgBox("Have you confirmed use with Department A?", vbQuestion + vbYesNo) = vbNo Then
    If MsgBox("Have you completed the questionnaire?", vbQuestion + vbYesNo) = vbNo Then
    If MsgBox("Have you received authorization to bypass?", vbQuestion + vbYesNo) = vbNo Then
    If MsgBox("Please contact Department A for further instruction.” & Chr(10) & Chr(10) & "Contact Jane Doe at 555-123-4567.", vbCritical + vbOK) = vbOK Then
    End If
    ElseIf Click = vbYes Then
    Sub Unhide_Sheets_Containing()
    Dim ws As Worksheet

    For Each ws In ActiveWorkbook.Worksheets
    If InStr(ws.Name, "Request Form") Then
    ws.Visible = xlSheetVisible
    End If
    Next ws
    ThisWorkbook.Sheets("Request Form").Activate
    End Sub
    End If
    ElseIf Response = vbYes Then
    For Each ws In ActiveWorkbook.Worksheets
    If InStr(ws.Name, "Request Form") Then
    ws.Visible = xlSheetVisible
    End If
    Next ws
    ThisWorkbook.Sheets("Request Form").Activate
    End If
    ElseIf Response = vbYes Then
    For Each ws In ActiveWorkbook.Worksheets
    If InStr(ws.Name, "Request Form") Then
    ws.Visible = xlSheetVisible
    End If
    Next ws
    ThisWorkbook.Sheets("Request Form").Activate
    End If
    End Sub

  2. #2
    Registered User
    Join Date
    12-06-2017
    Location
    Oklahoma City, OK
    MS-Off Ver
    MS Office 365
    Posts
    28

    Re: Help to Unhide a Worksheet based on IfMsgBox responses.

    I failed to mention that the hidden worksheet is password protected so only unlocked cells can be utilized.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Help to Unhide a Worksheet based on IfMsgBox responses.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-06-2017
    Location
    Oklahoma City, OK
    MS-Off Ver
    MS Office 365
    Posts
    28

    Re: Help to Unhide a Worksheet based on IfMsgBox responses.

    The coding above worked great to open the worksheet from being hidden. However, it won't open it when the workbook's structure is password protected. Any suggestions for adjusting the coding to accommodate that factor?

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Help to Unhide a Worksheet based on IfMsgBox responses.

    Add a code to unprotect the workbook.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-06-2017
    Location
    Oklahoma City, OK
    MS-Off Ver
    MS Office 365
    Posts
    28

    Re: Help to Unhide a Worksheet based on IfMsgBox responses.

    Thank you so much! This works great.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to hide unhide worksheet based on value?
    By putritersenyum in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-24-2016, 10:00 AM
  2. VBA to hide/unhide worksheet based on value
    By ahs004 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-24-2015, 11:55 PM
  3. Hide/Unhide Worksheet based on cell value derived from a IF Function
    By ecamoz in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-04-2014, 05:49 AM
  4. [SOLVED] UnHide a WorkSheet Based on a cell Value
    By JmundleBofA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2014, 02:03 PM
  5. Macro to unhide specific sheet based on worksheet name in cell.
    By CRIMEDOG in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-29-2013, 08:56 PM
  6. Hide/Unhide Rows in One Worksheet Based on Values in Cells in Another Worksheet
    By xponent_es in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-27-2011, 03:26 PM
  7. Hide/Unhide worksheet on open based on user name
    By tonywig in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2005, 12:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1