Problem with sort macro

K

Ken G.

I have the following macro to sort a range of data: (using Excel 2002)

Selection.Sort Key1:=Range("B6"), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom

When the macro is run it gives an error message "Run Time error 1004 - Sort method of range class failed".

All other sort macros in the spreadsheet also fail with the same error message but they have been working perfectly for about 3 weeks until now. The only diference that I can see is that the title bar now shows "Microsoft Excel - "File Name.xls" [Group]" I had not previously noticed the [Group] on the end of it. What does that indicate, and can anyone give me a clue as to what is causing the sort macro errors?

Thanks in advance,
Ken G.
 
D

Dave Peterson

Ungroup your worksheets.

Rightclick on any worksheet tab and select "Ungroup Sheets".

Grouping is very nice when you want to make the same change to the same address
on multiple sheets (like headers).

You can click on the first and ctrl-click on subsequent sheets. Excel does its
best to notify you by putting [Group] in the title bar.

You may want to check all the sheets that you had grouped. If you made changes
to any one of those, then that same change was made to all those grouped sheets.

(and some things are not available when sheets are grouped--like sorting.)
I have the following macro to sort a range of data: (using Excel 2002)

Selection.Sort Key1:=Range("B6"), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom

When the macro is run it gives an error message "Run Time error 1004 - Sort method of range class failed".

All other sort macros in the spreadsheet also fail with the same error message but they have been working perfectly for about 3 weeks until now. The only diference that I can see is that the title bar now shows "Microsoft Excel - "File Name.xls" [Group]" I had not previously noticed the [Group] on the end of it. What does that indicate, and can anyone give me a clue as to what is causing the sort macro errors?

Thanks in advance,
Ken G.
 
Top