unprotect worksheet when......

W

Wanna Learn

Hello is it possible to unprotect a worksheet when a certain cell is
selected using VBA . I need to unprotect the worksheet when cell B34 is
selected and remain unprotected.
thanks in advance
 
L

leerem

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Enter this routine in the class module of the sheet you wish to unprotect

If Target.Cells.Count > 1 Then
Exit Sub
End If
If Not Application.Intersect(Range("B34"), Target) Is Nothing Then
ActiveSheet.UnProtect
end if
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top