Help completing Current MACRO - Enable Auto Sort Of Table

98aallen

New Member
Joined
Oct 2, 2017
Messages
23
Hi,

Im looking to auto sort a column in sheet3, when data i, column J of sheet1 is changed, i currently have the bellow but it doesnt work?

any help is greatly appreciated

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target("sheet1").Range("J:J")) Is Nothing Then
Range("A3").Sort Key1:=Range("A4"), _
Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End If
End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi ,

This works with a range ; in case your data is in an Excel table , the code will need to be changed.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
            If Not Intersect(Target, Me.Range("J:J")) Is Nothing Then
               With ThisWorkbook.Worksheets("sheet3")
                    .Range("A3:A100").Sort Key1:=.Range("A4:A100"), _
                                      Order1:=xlAscending, Header:=xlYes, _
                                      OrderCustom:=1, MatchCase:=False, _
                                      Orientation:=xlTopToBottom
               End With
            End If
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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