Auto sort cells with formulas

Mrexel

New Member
Joined
Sep 15, 2014
Messages
2
Hello folks:
i have a simple problem and i am hoping you could help me, i searched for a solution in internet but nothing seems to help... my question is:
if i have this sheet:
A1=2*B1
A2 =2*B2
A3 =4*B3
B1=4
B2=1
B3=1
i want column "A" to be sorted in descending order automatically when i change the values of column "B".
Is there a formula for this? and if there is not, what the vba code for that?
thanks in advance :)
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
right-click the sheet tab, select View Code, enter this:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 2 Then Exit Sub
Range("A1").CurrentRegion.Sort key1:=[a1], Order1:=xlAscending, Header:=xlNo
End Sub
 
Upvote 0

Forum statistics

Threads
1,206,921
Messages
6,075,586
Members
446,147
Latest member
homedecortips

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