Multiple Worksheet Change

GDunn

Board Regular
Joined
Mar 24, 2009
Messages
51
Hi,

I have the following code working fine for one worksheet change trigger, however it does not run the second worksheet change.
Can anyone help please? Rng one works great, but Rng1 does not run.

Also, I would like to copy the data to the target and then clear the original row, rather than cut.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range
Dim Rng1 As Range
Set Rng = Target.Parent.Range("Table2")
Set Rng1 = Target.Parent.Range("Table6")
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Rng) Is Nothing Then Exit Sub

If Target.Value = "8. Booked" Then
Target.EntireRow.Cut _
Range("Table5").End(xlDown).Offset(1, 0)

ActiveWorkbook.Worksheets("Sheet1").ListObjects("Table2").Sort.SortFields.Add _
Key:=Range("Table2[CLV]"), SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").ListObjects("Table2").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

Else
If Target.Value = "9. Lost" Then
Target.EntireRow.Cut _
Range("Table1").End(xlDown).Offset(1, 0)

ActiveWorkbook.Worksheets("Sheet1").ListObjects("Table2").Sort.SortFields.Add _
Key:=Range("Table2[CLV]"), SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").ListObjects("Table2").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

End If
End If


If Target.Count > 1 Then Exit Sub
If Intersect(Target, Rng1) Is Nothing Then Exit Sub

If Target.Value = "8. Booked" Then
Target.EntireRow.Cut _
Range("Table5").End(xlDown).Offset(1, 0)

Else
If Target.Value = "9. Lost" Then
Target.EntireRow.Cut _
Range("Table1").End(xlDown).Offset(1, 0)
End If

End If

End Sub


Any help would be much appreciated.
Thanks in advance. (sorry for missed tags, pressed save too quickly!)
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi GDunn,

Try doing one test statement for Rng and Rng1 instead of separate tests.

Code:
If Intersect(Target, Rng) Is Nothing And _
    Intersect(Target, Rng1) Is Nothing Then Exit Sub
 
Upvote 0

Forum statistics

Threads
1,203,069
Messages
6,053,351
Members
444,655
Latest member
didr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top