Manuprasad
New Member
- Joined
- May 24, 2016
- Messages
- 39
I have Workbook with both Sheet/workbook is protected. I have a code to lock/disable certain range of cells when the drop-down value "no" And unlock/enable when value of drop down is "yes" Whereas, drop-down value and cells I would like to disable are on different sheets.
Dropdown on "Main Sheet" Range of cells on "Sub Sheet"
I also need to throw a prompt to user when he clicks on protected range and when the value is set to "No".
I am using following code on "Main Sheet"
Following code on "Subsheet"
But my concern is Its throwing prompt when cells are unlocked/enabled. I want it to throw a prompt when cells are locked/disabled. Please help
Dropdown on "Main Sheet" Range of cells on "Sub Sheet"
I also need to throw a prompt to user when he clicks on protected range and when the value is set to "No".
I am using following code on "Main Sheet"
Code:
[/COLOR]Private Sub Worksheet_Change(ByVal Target As Range)
Dim worksh As Integer
Dim worksheetexists As Boolean
Dim str1 As String
with ThisWorkbook.Sheets("SubSheet")
If UCase$(Range("E30").Value) = "YES" Then
.Range("E20:I3019").Locked = False
Else
.Range("E20:I3019").Locked = True
End If
end with
End If
Following code on "Subsheet"
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("E20:I3019").Locked = True Then
If Intersect(Target, Range("$E$19:$I$3000")) Is Nothing Then Exit Sub
MsgBox "Please select the appropriate dropdown on ARF Sheet"
With Application
.EnableEvents = False
.Undo
.EnableEvents = True
End With
End If
End Sub
But my concern is Its throwing prompt when cells are unlocked/enabled. I want it to throw a prompt when cells are locked/disabled. Please help