Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50049

[SOLVED] Attempting to define content in cell based on update of other cell in same row.

$
0
0
I am a newbie at programming. I am trying to modify (clear) the inputs in column C, D, H & J if the input on column A is changed. the following snippet of code works for the first row but does not for subsequent rows.

Code:

Private Sub Worksheet_Change(ByVal Target as Range)
  If Target = Range ("A8") Then
      Target.Offset (0,2).Value =""
      Target.Offset (0,2).Value =""
      Target.Offset (0,2).Value =""
      Target.Offset (0,2).Value =""
  End if
End Sub

I've determined that I need to put a loop and check if "Target" is in a range "column A". I've modified the code to something as below from my research online. From what I read on the internet it should work but I am having no luck. I would appreciate some feedback.

Code:

Private Sub Worksheet_Change(ByVal Target as Range)
  If Not Application.Intersect(Target, Range("A8:A3000")) is Nothing Then
      Target.Offset (0,2).Value =""
      Target.Offset (0,2).Value =""
      Target.Offset (0,2).Value =""
      Target.Offset (0,2).Value =""
  End if
End Sub

Thanks in advance
Yves

Viewing all articles
Browse latest Browse all 50049

Trending Articles