Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort
I need a command button to sort the entire sheet by column "A" in ascending
order. My button is only sorting column "A" and nothing else. Can someone please help me? Thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort
Just a thought...have you selected the entire sheet before the sort action?
"N. McCain" wrote: I need a command button to sort the entire sheet by column "A" in ascending order. My button is only sorting column "A" and nothing else. Can someone please help me? Thanks in advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort
Post your code... How many columns are there to sort...
-- HTH... Jim Thomlinson "N. McCain" wrote: I need a command button to sort the entire sheet by column "A" in ascending order. My button is only sorting column "A" and nothing else. Can someone please help me? Thanks in advance |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort
Private Sub CommandButton1_Click()
Range("a3").Activate Range("a3:a4000").sort Key1:=Range("a3") CommandButton1.Activate End Sub I need to be able to sort 4000 rows and columns A-L. "Jim Thomlinson" wrote: Post your code... How many columns are there to sort... -- HTH... Jim Thomlinson "N. McCain" wrote: I need a command button to sort the entire sheet by column "A" in ascending order. My button is only sorting column "A" and nothing else. Can someone please help me? Thanks in advance |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort
Also I need it to start sorting at row 3
"N. McCain" wrote: Private Sub CommandButton1_Click() Range("a3").Activate Range("a3:a4000").sort Key1:=Range("a3") CommandButton1.Activate End Sub I need to be able to sort 4000 rows and columns A-L. "Jim Thomlinson" wrote: Post your code... How many columns are there to sort... -- HTH... Jim Thomlinson "N. McCain" wrote: I need a command button to sort the entire sheet by column "A" in ascending order. My button is only sorting column "A" and nothing else. Can someone please help me? Thanks in advance |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort
change the a4000 to b4000, c4000 or whatever the last column you want to include
in the sort. -- Gary "N. McCain" wrote in message ... Also I need it to start sorting at row 3 "N. McCain" wrote: Private Sub CommandButton1_Click() Range("a3").Activate Range("a3:a4000").sort Key1:=Range("a3") CommandButton1.Activate End Sub I need to be able to sort 4000 rows and columns A-L. "Jim Thomlinson" wrote: Post your code... How many columns are there to sort... -- HTH... Jim Thomlinson "N. McCain" wrote: I need a command button to sort the entire sheet by column "A" in ascending order. My button is only sorting column "A" and nothing else. Can someone please help me? Thanks in advance |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort
I have figured out how to get it all to sort thanks to Don pointing out that
I needed to try and select the entire sheet. Below is my code. However, I have one more question/problem. I need this sheet to be protected. When I protect the sheet and then click the button, I get an error. When the sheet is unprotected, it will sort just fine. What code, if any, will help me sort this while the sheet is protected? Private Sub CommandButton1_Click() Range("a3").Activate Range("a3:L4000").sort Key1:=Range("a3:l4000") CommandButton1.Activate End Sub "N. McCain" wrote: I need a command button to sort the entire sheet by column "A" in ascending order. My button is only sorting column "A" and nothing else. Can someone please help me? Thanks in advance |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort
I finally got it to work. Here is some code to help anyone who may need it.
This will allow you to sort the entire sheet ascending by column A. It will sort 4000 rows and through column L starting at row 3. My sheet is protected, but I needed to allow the users to use the auto filter feature. Thanks for everyone's help with this. Sub ProtectionOptions() If ActiveSheet.Protection.AllowFiltering = False Then ActiveSheet.Protect AllowFiltering:=True End If End Sub Private Sub CommandButton1_Click() ActiveSheet.Unprotect Range("a3").Activate Range("a3:L4000").Sort Key1:=Range("a3:l4000") CommandButton1.Activate ActiveSheet.EnableAutoFilter = True ActiveSheet.Protect contents:=True, userInterfaceOnly:=True End Sub "N. McCain" wrote: I need a command button to sort the entire sheet by column "A" in ascending order. My button is only sorting column "A" and nothing else. Can someone please help me? Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Updating workbook with an alpha sort sheet and a numeric sort shee | Excel Discussion (Misc queries) | |||
sort function for dates does not sort properly in Office 2007 Exc. | Excel Worksheet Functions | |||
Pls. reply Sort Data and copy to next coulmn when sort order chang | Excel Programming | |||
Excel sort by Fill Color by custom list sort | Excel Discussion (Misc queries) | |||
sort (on part of) string - originally posted under Tricky Sort | Excel Programming |