ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   unprotect worksheet when...... (https://www.excelbanter.com/excel-discussion-misc-queries/213114-unprotect-worksheet-when.html)

Wanna Learn

unprotect worksheet when......
 
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

leerem

unprotect worksheet when......
 
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

"Wanna Learn" wrote:

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



All times are GMT +1. The time now is 04:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com