Thread: Sort
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
N. McCain[_2_] N. McCain[_2_] is offline
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