VBA Auto sort looking at if changes in other sheets for changes?

Emerlin

Board Regular
Joined
Jan 8, 2007
Messages
105
Hi,

I am using this VBA script to get some sorting done. But my cells reference formulas on other sheets that do not trigger it as the cell changing - hope that makes sense. Can I nest and Else if to look at the other sheets to trigger the changes?

Working...

Private Sub Worksheet_Change(ByVal Target As Range)
'Sort Name
On Error Resume Next
If Not Intersect(Target, Range("C3:H17")) Is Nothing Then
Range("C3:H17").Sort Key1:=Range("H3:H17"), _
Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub

Something like....

Private Sub Worksheet_Change(ByVal Target As Range)
'Sort Name
On Error Resume Next
If Not Intersect(Target, Range("C3:H17")) Is Nothing Then
ElseIf Not Intersected (Sheet("Sheet2").Range("A1:A33)) Is Nothing Then
Range("C3:H17").Sort Key1:=Range("H3:H17"), _
Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub

I am trying to get the sorting to trigger if changes occur in either sheet or possibly sheets in the future.

Thanks in advance for any/all help.
 

Forum statistics

Threads
1,086,116
Messages
5,387,922
Members
402,088
Latest member
poppa57

Some videos you may like

This Week's Hot Topics

Top