Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
False alarm.
For those interested in the work around: Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("C9:C42")) Is Nothing Then If Target.Cells.Count 1 Then Exit Sub 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 If Target.Cells.Count 1 Then Exit Sub Target.Offset(0, 2).Select End If End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mark,
Am Mon, 16 Nov 2020 17:32:30 -0800 (PST) schrieb NoodNutt: Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("C9:C42")) Is Nothing Then If Target.Cells.Count 1 Then Exit Sub 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 If Target.Cells.Count 1 Then Exit Sub Target.Offset(0, 2).Select End If End Sub try: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("C9:C42,H9:H42")) Is Nothing _ Or Target.Count 1 Then Exit Sub Select Case Target.Column Case 3 If Target.Value = "YARD" Then Target.Offset(, 7).Select Else Target.Offset(, 1).Select End If Case 8 Target.Offset(, 2).Select End Select End Sub Regards Claus B. -- Windows10 Office 2016 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As always Claus you're there, thank you.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
worksheet_change becoming active just by entering the cell | Excel Programming | |||
deleting cell range in a worksheet_change subroutine | Excel Programming | |||
How to get the correct active Cell position in Worksheet_Change | Excel Programming | |||
Disabling worksheet_change when deleting rows . . | Excel Programming | |||
Deleting all rows after the last active cell | Excel Programming |