View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Two diff passwords(or protection) for sepate columns.

Sub Test()
Dim v
Dim a As Byte
' assumes sheet1 already protected with "password"
v = InputBox("Enter password A or B")
Select Case v
Case "pass1": a = 1
Case "pass2": a = 2
Case Else
If Len(v) Then a = 99
End Select

If a = 99 Then
MsgBox "password not recognized"
ElseIf a Then
On Error Resume Next
Worksheets("Sheet1").Unprotect "password"
On Error GoTo errH
If a = 1 Then
Worksheets("Sheet1").Columns("A:N").Cells.Locked = False
ElseIf a = 2 Then
Worksheets("Sheet1").Columns("O:T").Cells.Locked = False
End If
Worksheets("Sheet1").Protect "password", True, True

End If

Exit Sub
errH:
MsgBox Err.Description
End Sub

Regards,
Peter T
"roshinpp_77"
wrote in message
...

Hi members,
I want help in an interesting case.


Is there any way to protect the worksheet with two diiff
passwords...say

column A to column N protected with one password and column O to column
column T with another password.

Please advice..If not possible kindly suggest some alternate method

TIA Roshin


--
roshinpp_77
------------------------------------------------------------------------
roshinpp_77's Profile:

http://www.excelforum.com/member.php...o&userid=34924
View this thread: http://www.excelforum.com/showthread...hreadid=568926