Emerlin
Board Regular
- Joined
- Jan 8, 2007
- Messages
- 117
- Office Version
- 2016
- Platform
- Windows
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.
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.