#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Don Don is offline
external usenet poster
 
Posts: 487
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating workbook with an alpha sort sheet and a numeric sort shee cjlatta Excel Discussion (Misc queries) 2 January 28th 09 12:00 AM
sort function for dates does not sort properly in Office 2007 Exc. Rosalie Excel Worksheet Functions 1 November 22nd 07 10:25 PM
Pls. reply Sort Data and copy to next coulmn when sort order chang shital shah Excel Programming 1 August 19th 05 02:51 PM
Excel sort by Fill Color by custom list sort Dash4Cash Excel Discussion (Misc queries) 2 July 29th 05 10:45 PM
sort (on part of) string - originally posted under Tricky Sort Tom Ogilvy Excel Programming 0 August 6th 04 02:42 AM


All times are GMT +1. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"