Sort Macro Button

Emb21

Board Regular
Joined
Jul 8, 2004
Messages
152
Hello,

I have room numbers, and names I would like to sort...ascending to descending.

I know how to use the sort but would like users to have a button that will automatically do it for them.

Say column A7 was header and A8 thru A200 was the data to the sort.

Do I need a macro for this or is there another feature. (Excel 2000)

Thanks, :biggrin:
Eric
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
You could put this is a macro and assign it to a button:
Code:
Sub sort()
Range("A7:A" & Range("A65536").End(xlUp).Row).Sort Key1:=Worksheets("Sheet1").Range("A7"), header:=xlYes
End Sub
That will sort from A7 (where your header is) to the last row in column A that contains data in ascending order. Hope that helps!
 
Upvote 0
Is your worksheet named "Sheet1?" If not, that would do it. Change Sheet1 in the code to your sheet name.
 
Upvote 0

Forum statistics

Threads
1,214,874
Messages
6,122,034
Members
449,061
Latest member
TheRealJoaquin

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