Sub test() With ActiveCell.Offset(1) If .Locked = True Then Range("A1").Value = "a" Else .Value = "a" End If End With End Sub