Hello,
Can you please help? I'm not a programmer. I have 43 worksheets in a workbook. Using buttons I want to protect worksheets, hide worksheets or unhide worksheets. Can I use a loop or if statement to easily do this instead of the current statements I'm using:
sheets("Name1").visible = true
sheets("Name2").visible = true
sheets("Name3").visible = true
etc....
I've been playing with the if statement below which I found on this website but I'm getting a compile error message.
Dim wsht as worksheet
Dim i as integer
if InputBox("Enter Password", "Password") <> "xxx"
Then MsgBox "Incorrect Password", vbCritical
Exit Sub
Else For Each wsht in ThisWorkbook.Worksheets For i = 1 to 43 wsht.Visible=xlSheetVisible
Next i
Next wsht
End If
End Sub
Thank you much.
Bookmarks