Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Sorting Data on Protected Worksheets.
by Allen Wyatt
(last updated October 1, 2016)
When you protect a worksheet, Excel stops users from performing a wide variety of tasks on the data in the worksheet. One of the things that the user can no longer do is to sort data. What if you want the user to be able to sort data, but still have the sheet protected?
If you are using Excel 2002 or Excel 2003 the answer is quite easy: These versions of Excel allow you to specify what users can and cannot do with a protected worksheet. When you choose Tools | Protection | Protect Sheet, Excel displays the Protect Sheet dialog box. At the bottom of the dialog box is a long list of check boxes. All you need to do is select what the user should be able to do with the worksheet. One of the options (you need to scroll down a bit) is Sort. If you select this option, then users can sort protected data.
If you are using an older version of Excel, the solution is to create a macro that unprotects the worksheet, sorts the data, and then protects the worksheet again. The following is a simple example:
Sub Sorting() ActiveSheet.Unprotect Range("A1:D100").Sort Key1:=Range("A1"), _ Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, _ Orientation:=xlTopToBottom ActiveSheet.Protect End Sub
This example sorts the data in the range A1:D100 based on the contents of column A. The macro illustrates the general concept behind this approach, but you will need to modify it to reflect the needs of your data and your users.
If you go the macro route, you need to assign the macro to either a toolbar button or a menu command. If you don't the user will never be able to use it, since the Macros menus are disabled in a protected document.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2458) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Sorting Data on Protected Worksheets.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!
Excel allows you to sort but up to three columns, but you may want to sort by more than that. This tip provides ways you can ...Discover More
One way you can easily work with data in a worksheet is to sort it into whatever order you find most helpful. Excel allows ...Discover More
When you sort data that contains both numbers and text, you may not get exactly the result that you expected. To know what is ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."