How will the users with the password be able to view the columns that are hidden?
How will the users with the password be able to view the columns that are hidden?
the code works but the only problem I have is that anyone could come into the sheet and unhide the columns manually by marking the column F, right click and unhide option...
Better to keep the same password for all.
Change the "hs" to your password... and in bracket pswrd = "Change this to your password" to the same password.
Cleaner and you will only have to change your pswrd on top... (Change "hs" to your password)
![]()
Private Sub CommandButton1_Click() Dim pswrd As String pswrd = "hs" Application.ScreenUpdating = False Application.EnableEvents = False Password = InputBox("A password is required to run this procedure." & vbCrLf & _ "Please enter the password:", "Password") If Password <> pswrd Then MsgBox ("Wrong Password") Else ActiveSheet.Unprotect pswrd Columns("A:E").EntireColumn.Hidden = True = Not _ Columns("A:E").EntireColumn.Hidden = True ActiveSheet.Protect pswrd End If Application.EnableEvents = True Application.ScreenUpdating = True End Sub
you are a genius, many thanks
please how can protect just these specific colums not all sheet, thanks
Administrative Note:
Welcome to the forum.
We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.
Please see Forum Rule #4 about hijacking and start a new thread for your query.
If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
2. If your question is resolved, mark it SOLVED using the thread tools
3. Click on the star if you think someone helped you
Regards
Ford
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks