View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
NoodNutt[_2_] NoodNutt[_2_] is offline
external usenet poster
 
Posts: 39
Default Deleting rows when Worksheet_Change active

Hi Team

The below Worksheet_Change codes work as expected, with one caveat, I get an error if I delete any rows within the Target(Range).

I fully appreciate and understand Error Handling, but I am unsure as to which way to approach this particular issue.

Does anyone have a handy line of Error Handling code I can insert that will suppress the Error popup from displaying If/When rows are deleted please.

As always, TIA
Mark.

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("C9:C42")) Is Nothing Then
If Target.Value = "YARD" Then
Target.Offset(0, 7).Select
Else
Target.Offset(0, 1).Select
End If
End If

If Not Intersect(Target, Range("H9:H42")) Is Nothing Then
Target.Offset(0, 2).Select
End If

End Sub