I have the following code, I need it to sort all the sheets in my workbook on the first column. The below code doesnt seem to work for me though.

I get the error:

Run-time error '1004':
The sort reference is not valid.

When I make a macro the sort code line is exactly the same though :-S

Private Sub CommandButton1_Click()
    For x = 2 To Application.Sheets.Count
        Sheets(x).Activate
        Sheets(x).Cells.Select
        Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
Next
End Sub
Thanks for any help

Jay