I want to sort a range of cells using a macro in Excel 97. The basic macro works fine. But the ultimate goal of the worksheet is an enduser form that is “dummy” proof, so most cells are locked, and many hidden. The range in question is NOT locked, but when I protect the sheet and run the macro that sorts the range, I get a run-time error (1004) and the message “Sort method of Range class failed.”
Any ideas on how to write a VBA module that will sort this range even in a protected sheet?
Sample VBA …
Range(“AW67:AW88”).Select
Selection.Sort Key1:=Range(“AW67”), Order1:=xlAscending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range(“AX67:AX88”).Select
Selection.Sort Key1:=Range(“AX67”), Order1:=xlAscending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom