jammer6_9
10-21-2012, 08:06 AM
I have a selection based on a data validation where if the value is "O", i want to select 2 cells to the right and protect it else unprotect it.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
If ActiveCell.Value = "O" Then 'is a data validation selection
'How to make below statement in one statement
ActiveCell.Offset(0, 1).Select
ActiveCell.ClearContents
ActiveCell.Offset(0, 1).Select
ActiveCell.ClearContents
'I want to protect the 2 off set cell
Else
'I want to unprotect the 2 off set cell
End If
Application.ScreenUpdating = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
If ActiveCell.Value = "O" Then 'is a data validation selection
'How to make below statement in one statement
ActiveCell.Offset(0, 1).Select
ActiveCell.ClearContents
ActiveCell.Offset(0, 1).Select
ActiveCell.ClearContents
'I want to protect the 2 off set cell
Else
'I want to unprotect the 2 off set cell
End If
Application.ScreenUpdating = True
End Sub