Excel CHALLENGE anyone??

ntruong

Active Member
Joined
Aug 4, 2003
Messages
261
The challenge is how to protect only selected columns with a password from a protected worksheet without a ps.
The goal is for employee to make format changes as they wish but they cannot open the password-protected columns.

Again, I wonder if excel can do something like this.

Please shed some light. Thanks.

Nee
 
Hello,

Now the codes below work fine to hide col D but when I exit the file and open it again, I can open col D without being stop by a password ????

Any clue?? Many thanks,
========================================
Dim booLocked As Boolean

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' Example of how to protect a portion of a WS using
' VB instead of Excel's built-in WS protection.

Dim strPassword As String, strMsg As String

If Not Intersect(Target, Union(Columns("C:E"), Range("D:D"))) Is Nothing Then
If booLocked Then
strMsg = "Please enter the password needed to work on these cells." & vbCr & _
"Note: Password protection will reset once you select outside the protected area."
strPassword = InputBox(strMsg, "Protected Columns")
booLocked = Not (strPassword = "Secret")
End If
If booLocked Then
Application.EnableEvents = False
Application.Goto Range("E" & Target.Row)
Application.EnableEvents = True
End If
Else
booLocked = True
End If

End Sub
 
Upvote 0
Hi Nee,

For some reason I didn't get an e-mail noting further posts to this thread - I just got luck and happened to see it...

I've got to leave, but in skimming this, I think I can offer you a quick fix:

In your workbook's OPEN method just add a line of code to set booLocked to TRUE.

Code:
Private Sub Workbook_Open()
    booLocked = True
End Sub

Regards,
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top