Private Sub CommandButton1_Click()
Dim Pw$
Pw = InputBox("Enter password to proceed", "Enter Password")
If Len(Pw) = 0 Then Exit Sub
If Pw <> "YourPassword" Then MsgBox "Incorrect password.", , "Invalid Pasword": Exit Sub
With CommandButton1
If .Caption = "Hide Columns" Then
Columns("A:D").Hidden = True
.Caption = "Show Columns"
Else
Columns("A:D").Hidden = False
.Caption = "Hide Columns"
End If
End With
End Sub
Private Sub ToggleButton1_Click()
a = InputBox("Enter password:", "Enter Password")
If a <> "mypassword" Then
MsgBox "wrong password"
End
End If
If ToggleButton1.Value = False Then
Range("C:D, F:G, I:J, M:P, R:S, U:V, X:Y, AA:AD, AF:AG").EntireColumn.Hidden = True
ToggleButton1.Caption = "Show Raw Data"
Else
Range("C:D, F:G, I:J, M:P, R:S, U:V, X:Y, AA:AD, AF:AG").EntireColumn.Hidden = False
ToggleButton1.Caption = "Hide Raw Data"
End If
End Sub
Range("C:D,F:G,I:J,M:P,R:S,U:V,X:Y,AA:AD,AF:AG").Select
Selection.EntireColumn.Hidden = False
Range("C:D, F:G, I:J, M:P, R:S, U:V, X:Y, AA:AD, AF:AG").EntireColumn.Hidden = False
Private Sub ToggleButton1_Click()
a = InputBox("Enter password:", "Enter Password")
If a <> "go" Then
MsgBox "wrong password"
End
End If
If ToggleButton1.Value = False Then
Range("C:D,F:G,I:J,M:P,R:S,U:V,X:Y,AA:AD,AF:AG").Select
Selection.EntireColumn.Hidden = True
ToggleButton1.Caption = "Show Raw Data"
Else
Range("C:D,F:G,I:J,M:P,R:S,U:V,X:Y,AA:AD,AF:AG").Select
Selection.EntireColumn.Hidden = False
Range("C5").Select
ToggleButton1.Caption = "Hide Raw Data"
End If
End Sub
Range("C:D, F:G, I:J, M:P, R:S, U:V, X:Y, AA:AD, AF:AG").EntireColumn.Hidden = False