Auto Sort Range of Cells

caj1980

Board Regular
Joined
Oct 23, 2013
Messages
108
I have seen several posts that answer my question but I am not smart enough to tweak the code to fit my cell range. Could someone please help me write the script to put in my VBA code to auto-sort Range A9:D17 any time a value in Column D changes. Note that Column D cells are actually formulas that reference other cells in the workbook (=Sheet2!D7). Thanks!
ABCD
9Johnson16486
10White57452
11Peden85385
12Shearin44245
13Roberts99132
14Donaldson32120
15Rodriguez7184
16Catalano4642
17Butler8312

<tbody>
</tbody>
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
clarification: sort range A9:D17 based on values in Column D, triggered by any change to Column D
 
Upvote 0
Was it this one?
Rich (BB code):
' Put this code into the sheet's module
Private Sub Worksheet_Calculate()
  Range("A9:D17").Sort Range("D17"), xlAscending, Header:=xlNo
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,516
Messages
6,125,285
Members
449,218
Latest member
Excel Master

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