Sorty by Value

Softwarez

Board Regular
Joined
Oct 21, 2005
Messages
57
Basically i want to hit a button on a form and it sorts a range of cells (in a column going down) in Value order, Lowest at the top, how can this be done? Thankyou.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Record a macro in which you select the column and sort it in the order you want.

Then from the View menu, choose toolbars, then "forrms".

Choose the command button and draw it where you want it. It will ask you to assign a macro.
 
Upvote 0
Why not just record sorting the range the way you want and then assign that to a button?

You could do the same if you're talking about a UserForm, but just adding the code to a UF Button Click event.

HTH,

Smitty
 
Upvote 0
You can add this code to a button:


Sub Sort()

'Sort data on Tire shipments based on MSPN

Sheets("Sheet2").Select
Range("B4:R61000").Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("D4:D61000"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

'Reposition back on Enter
Sheets("Sheet1").Select

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,397
Members
449,081
Latest member
JAMES KECULAH

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