View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
chijanzen chijanzen is offline
external usenet poster
 
Posts: 139
Default Switch cells on input

Dan:

try

With Target
If Cells(.Row, 6) = 1 And Cells(.Row, 8).Value = 1 Then
Range(Cells(.Row, 6), Cells(.Row, 8)).ClearContents
Cells(.Row, 4).Value = 1
End If
End With

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"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