Macro help
Good Morning ChuckF
This will remove data from J, L and M:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim newcell As Range
With Target
If Cells(.Row, "L") = "" Or Cells(.Row, "M") = "" Then Exit Sub
Application.EnableEvents = False
Set newcell = Cells(.Row, "IV").End(xlToLeft).Offset(0, 1)
With Cells(.Row, "J")
If newcell.Column < 26 Then
Cells(.Row, "Z").Value = .Value
Else
newcell.Value = .Value
End If
.ClearContents 'delete this line to preserve your VLOOKUP
End With
Range(Cells(.Row, "L"), Cells(.Row, "M")).ClearContents
End With
Set newcell = Nothing
Application.EnableEvents = True
End Sub
I note your comment that J contains a VLOOKUP so I guess you might not
actually want to clear the contents, thereby deleting the formula too.
If that's the case then delete the marked line above.
Regards
Steve
|