Sorting

  • Thread starter FloatingBubbles
  • Start date
F

FloatingBubbles

How do I go about setting up a single cell at the top of the worksheet that
with one click, it will sort the whole table? They have it set up to do that
with the worksheets at work and I'd like to be able to do it here at home.
 
J

j

all you have to do is go to tools-->macros-->record macros

then you highlight either the whole table or just the column you want to
sort. when you're done, click on the stop button. save the macro.

go to the control toolbar and create a button. right click on the button and
go to view code. go to tools-->macro and select your macro and click on
edit...highlight the text that's in black and insert that into the other
window which says private sub commandbutton1_click. save and this should be
it. the code should look something like this:

Private Sub CommandButton1_Click()
Cells.Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
 
T

T

Hi
If your'e not into macros, there's an easier way:
Data-filter-autofilter.
Don't know if the're the same in english, but Data- then the second line,
then follow the arrow and then click the first line. I think this is what you
mean, it'll show a little button on the top of each row to sort the data.
Hop you can use it.
Therese


"FloatingBubbles" skrev:
 
D

David McRitchie

Whether you use a macro, do your sort manually, or use the sort button, or your own button
you probably want to select all cells on the worksheet or use cells. for the range;
otherwise you are putting your data at risk.

Read about sorting and why you do not want to select one cell, and use the
current range Ctrl+* based on a single cell.
http://www.mvps.org/dmcritchie/excel/sorting.htm
--
 
Top