Switch cells on input
And if you don't want to also clear the contents of the cell in column G
then try:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("D6:L17")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
Application.ScreenUpdating = False
With Target
If Cells(.Row, 6).Value = 1 _
And Cells(.Row, 8).Value = 1 Then
Cells(.Row, 6).ClearContents
Cells(.Row, 8).ClearContents
Cells(.Row, 4).Value = 1
End If
End With
CleanUp:
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Hope this helps
Rowan
Dan wrote:
I'm using Worksheet_Change for a range d6:l17 . What I am trying to
accomplish is if 1 is entered in F and a 1 is entered in H both contence is
cleared and a 1 is placed on d.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("D6:L17")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
Application.ScreenUpdating = False
With Target
If Range(Cells(.Row, 6)) And Range(Cells(.Row, 8)).Value = 1 Then
Range(Cells(.Row, 6), Cells(.Row, 8)).ClearContents
Range(Cells(.Row, 4)).Value = 1
End If
End With
CleanUp:
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
??? Thanks for the help
|