How to enable sorting and filtering?

K

K.Parker

Hi,
I would like to ask "How to enable sorting and Filtering" after protecting a worksheet.
Since I don't want users to modify the worksheet don't can use the Autofilter and sorting function.
Does it invlve macro?
Thanks for your help.
 
C

Chip Pearson

In Excel 2002 and later, you can allow users to sort a protected sheet by
going to the Tools menu, choosing Protect Sheet and putting a check next to
"Sort" in the "Allow all users of this worksheet to:" list box. This is not
available in earlier versions.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com (e-mail address removed)


K.Parker said:
Hi,
I would like to ask "How to enable sorting and Filtering" after protecting a worksheet.
Since I don't want users to modify the worksheet don't can use the
Autofilter and sorting function.
 
R

Ronald Dodge

I had a similar type issue a long while ago. What I did was created a macro
that unprotected the worksheet, did the sorting, then password protected the
worksheet again. This was done in XL97. Your code may look something like:

Workbooks("Book1.xls").Worksheets("Sheet1").Unprotect Password := "Password"
<Put in your sorting/filtering code>
Workbooks("Book1.xls").Worksheets("Sheet1").Protect Password := "Password"

If you are working with Excel 2002 or later, you do have a worksheet
protection option, though there's a catch to it too.

When you protect the worksheet, you can allow for either, or both, Sorting
and Filtering. The catch to this, ALL of the cells within the
sorting/filtering area MUST BE UNPROTECTED with which ever or both of these
options set to "True", in order for the user to sort/filter the sort/filter
area on a protected worksheet.

For more info on this, you can goto Excel VBA help, and look under the
"Protect Method" help page, or the spreadsheet side of the protection under
"About worksheet and workbook protection". However, the VBA help page gives
you more specific information than the spreadsheet side help page does,
which can prove to be very useful.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
K.Parker said:
Hi,
I would like to ask "How to enable sorting and Filtering" after protecting a worksheet.
Since I don't want users to modify the worksheet don't can use the
Autofilter and sorting function.
 
T

Tom Ogilvy

Look in help at the enableautofilter property in Excel VBA help.

for sorting, you would have to offer an interface to the user that triggers
code to unprotect the worksheet, sorts it, and reprotects it.

--
Regards,
Tom Ogilvy

K.Parker said:
Hi,
I would like to ask "How to enable sorting and Filtering" after protecting a worksheet.
Since I don't want users to modify the worksheet don't can use the
Autofilter and sorting function.
 
T

Tom Ogilvy

See answers from Chip and Ronald if you have xl2002 and all your users would
have xl2002.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top