Tuesday, October 17, 2017

conditionally unlock a cell using vba,vba teacher sourav,Kolkata 09748184075

Sub test1()
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim cells As Range
Dim workingsheet As Worksheet
Set workingsheet = Worksheets("Sheet1")
Set cells = workingsheet.Range("G5")

Sheets("Sheet1").Activate

Range("G1").Select
If ActiveCell.Value = "A" Then
workingsheet.Unprotect Password:="0000"
cells.Locked = False
cells.Value = "Got it"
 workingsheet.Protect Password:="0000"
 Else

 End If

Application.ScreenUpdating = True
Application.EnableEvents = True



End Sub

No comments:

Post a Comment