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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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,223,911
Messages
6,175,331
Members
452,636
Latest member
laura12345

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