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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Tazguy37

MrExcel MVP
Joined
May 28, 2004
Messages
4,237
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!
 

Tazguy37

MrExcel MVP
Joined
May 28, 2004
Messages
4,237
Is your worksheet named "Sheet1?" If not, that would do it. Change Sheet1 in the code to your sheet name.
 

Forum statistics

Threads
1,147,846
Messages
5,743,515
Members
423,801
Latest member
paulj4177

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
Top