Sorting tables on protected worksheets

How do we configure our worksheet so that we can turn protection ON, but 
still enable the table filter buttons in order to sort columns in a table?

No matter what settings we select for protection, including the sort and 
auto-filter options, we cannot sort tables on a protected sheet.  What is 
the secret to allowing table sorts on a protected sheet? 

0
Blue
4/10/2010 8:22:00 PM
excel.newusers 15348 articles. 2 followers. Follow

7 Replies
1700 Views

Similar Articles

[PageSpeed] 37

Generally one has code to unprotect, code to do the sort, then re-protect.

By "tables" do you a real Table created by Insert>Table?

I can provide code that turns off protection when you click inside a Table.

Click outside the Table and protection goes back on.

Is this something you could work with?


Gord Dibben  MS Excel MVP

On Sat, 10 Apr 2010 14:22:00 -0600, "Blue Max" <mailrichard@msn.com> wrote:

>How do we configure our worksheet so that we can turn protection ON, but 
>still enable the table filter buttons in order to sort columns in a table?
>
>No matter what settings we select for protection, including the sort and 
>auto-filter options, we cannot sort tables on a protected sheet.  What is 
>the secret to allowing table sorts on a protected sheet? 

0
Gord
4/10/2010 8:56:50 PM
If Gord's suggestion and offer of assistance isn't what you need, then things 
get a little flakey for you:  In order to sort on a protected sheet, all of 
the cells that may potentially be involved in the sort must be unlocked.  
Quite often this defeats at least part of the purpose of protecting the sheet 
in the first place.  As Gord said, the typical way to handle this enigma is 
via VBA code that unprotects the sheet, does the sort and then puts the sheet 
back into protected mode.

"Blue Max" wrote:

> How do we configure our worksheet so that we can turn protection ON, but 
> still enable the table filter buttons in order to sort columns in a table?
> 
> No matter what settings we select for protection, including the sort and 
> auto-filter options, we cannot sort tables on a protected sheet.  What is 
> the secret to allowing table sorts on a protected sheet? 
> 
> .
> 
0
Utf
4/11/2010 12:31:01 AM
Record a macro for your sort, then see this page;
http://www.ozgrid.com/VBA/excel-macro-protected-sheet.htm

The UserInterfaceOnly is my preference in case the Macro bugs out leaving 
your Worksheet unprotected.




-- 
Regards
Dave Hawley
www.ozgrid.com
"Blue Max" <mailrichard@msn.com> wrote in message 
news:O7xsutO2KHA.5212@TK2MSFTNGP04.phx.gbl...
> How do we configure our worksheet so that we can turn protection ON, but 
> still enable the table filter buttons in order to sort columns in a table?
>
> No matter what settings we select for protection, including the sort and 
> auto-filter options, we cannot sort tables on a protected sheet.  What is 
> the secret to allowing table sorts on a protected sheet? 

0
ozgrid
4/11/2010 2:15:04 AM
Thank you, Gord.  I would be interested in a sample of the code.  I have 
created code before to protect and unprotect a sheet tied to a button or 
cell, but haven't ever tied it to selecting a table or not.  That may be a 
useful approach to this problem.  Nevertheless, can you answer the 
following:

As I indicated in the original message, when a worksheet is protected the 
user can choose options to allow auto-filtering or sorts.  When these 
options are chosen, why is the program not allowing the user to sort the 
table using the filter buttons or a sort?  One would infer from the 
protection options selected that the sort would be allowed!

Thanks,

Richard

****************************
"Gord Dibben" <gorddibbATshawDOTca> wrote in message 
news:nrn1s5ll7fcearto8nv219a2tc39ute4ck@4ax.com...
> Generally one has code to unprotect, code to do the sort, then re-protect.
>
> By "tables" do you a real Table created by Insert>Table?
>
> I can provide code that turns off protection when you click inside a 
> Table.
>
> Click outside the Table and protection goes back on.
>
> Is this something you could work with?
>
>
> Gord Dibben  MS Excel MVP
>
> On Sat, 10 Apr 2010 14:22:00 -0600, "Blue Max" <mailrichard@msn.com> 
> wrote:
>
>>How do we configure our worksheet so that we can turn protection ON, but
>>still enable the table filter buttons in order to sort columns in a table?
>>
>>No matter what settings we select for protection, including the sort and
>>auto-filter options, we cannot sort tables on a protected sheet.  What is
>>the secret to allowing table sorts on a protected sheet?
> 
0
Blue
4/22/2010 8:44:15 AM
I agree that the help on allowing sorting and filtering is not too detailed
and the implication is that you need only allow these options to be enabled
when protecting.

Not exactly true.

A protected sheet can be sorted or filtered but only under certain
conditions.

If the entire range to be sorted contains unlocked cells, you can sort that
range on a protected sheet.

If the Autofilter is enabled prior to protecting the sheet, autofilter can
be used.

Both options must be enabled when protecting the sheet.

Code to select a Table and unprotect the sheet.

Note that all cell protection within the Table is is removed.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
   Dim objlist As ListObject
   Set objlist = Me.ListObjects(1)   'adjust the (1) if needed
   On Error GoTo ws_exit:
    Application.EnableEvents = False
     If Not Intersect(Target, objlist.Range) Is Nothing Then
         Me.Unprotect Password:="justme"
         Else
         With Me
            .Protect Password:="justme"
            .EnableSelection = xlNoRestrictions
         End With
    End If
ws_exit:
    Application.EnableEvents = True
End Sub


Gord

On Thu, 22 Apr 2010 02:44:15 -0600, "Blue Max" <mailrichard@msn.com> wrote:

>Thank you, Gord.  I would be interested in a sample of the code.  I have 
>created code before to protect and unprotect a sheet tied to a button or 
>cell, but haven't ever tied it to selecting a table or not.  That may be a 
>useful approach to this problem.  Nevertheless, can you answer the 
>following:
>
>As I indicated in the original message, when a worksheet is protected the 
>user can choose options to allow auto-filtering or sorts.  When these 
>options are chosen, why is the program not allowing the user to sort the 
>table using the filter buttons or a sort?  One would infer from the 
>protection options selected that the sort would be allowed!
>
>Thanks,
>
>Richard
>
>****************************
>"Gord Dibben" <gorddibbATshawDOTca> wrote in message 
>news:nrn1s5ll7fcearto8nv219a2tc39ute4ck@4ax.com...
>> Generally one has code to unprotect, code to do the sort, then re-protect.
>>
>> By "tables" do you a real Table created by Insert>Table?
>>
>> I can provide code that turns off protection when you click inside a 
>> Table.
>>
>> Click outside the Table and protection goes back on.
>>
>> Is this something you could work with?
>>
>>
>> Gord Dibben  MS Excel MVP
>>
>> On Sat, 10 Apr 2010 14:22:00 -0600, "Blue Max" <mailrichard@msn.com> 
>> wrote:
>>
>>>How do we configure our worksheet so that we can turn protection ON, but
>>>still enable the table filter buttons in order to sort columns in a table?
>>>
>>>No matter what settings we select for protection, including the sort and
>>>auto-filter options, we cannot sort tables on a protected sheet.  What is
>>>the secret to allowing table sorts on a protected sheet?
>> 

0
Gord
4/22/2010 7:42:38 PM
Thank you, Dave, some interesting features.  I appreciate your reply and 
will take a look at this option.

Thanks,

Richard

*****************
"ozgrid.com" <dave@ozgrid.com> wrote in message 
news:BBBB76E2-C991-41B4-84F8-8A191101E21A@microsoft.com...
> Record a macro for your sort, then see this page;
> http://www.ozgrid.com/VBA/excel-macro-protected-sheet.htm
>
> The UserInterfaceOnly is my preference in case the Macro bugs out leaving 
> your Worksheet unprotected.
>
>
>
>
> -- 
> Regards
> Dave Hawley
> www.ozgrid.com
> "Blue Max" <mailrichard@msn.com> wrote in message 
> news:O7xsutO2KHA.5212@TK2MSFTNGP04.phx.gbl...
>> How do we configure our worksheet so that we can turn protection ON, but 
>> still enable the table filter buttons in order to sort columns in a 
>> table?
>>
>> No matter what settings we select for protection, including the sort and 
>> auto-filter options, we cannot sort tables on a protected sheet.  What is 
>> the secret to allowing table sorts on a protected sheet?
> 

0
Blue
4/29/2010 3:42:50 PM
Thank you, Gord, I appreciate the guidelines and the suggested code.  Wish 
the protection exceptions would have covered this case, but they apparently 
do not.  Oh well, perhaps in a future version.

****************
"Gord Dibben" <gorddibbATshawDOTca> wrote in message 
news:gh81t5hdc9os2gofn519f345cfq7g7086c@4ax.com...
>I agree that the help on allowing sorting and filtering is not too detailed
> and the implication is that you need only allow these options to be 
> enabled
> when protecting.
>
> Not exactly true.
>
> A protected sheet can be sorted or filtered but only under certain
> conditions.
>
> If the entire range to be sorted contains unlocked cells, you can sort 
> that
> range on a protected sheet.
>
> If the Autofilter is enabled prior to protecting the sheet, autofilter can
> be used.
>
> Both options must be enabled when protecting the sheet.
>
> Code to select a Table and unprotect the sheet.
>
> Note that all cell protection within the Table is is removed.
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
>   Dim objlist As ListObject
>   Set objlist = Me.ListObjects(1)   'adjust the (1) if needed
>   On Error GoTo ws_exit:
>    Application.EnableEvents = False
>     If Not Intersect(Target, objlist.Range) Is Nothing Then
>         Me.Unprotect Password:="justme"
>         Else
>         With Me
>            .Protect Password:="justme"
>            .EnableSelection = xlNoRestrictions
>         End With
>    End If
> ws_exit:
>    Application.EnableEvents = True
> End Sub
>
>
> Gord
>
> On Thu, 22 Apr 2010 02:44:15 -0600, "Blue Max" <mailrichard@msn.com> 
> wrote:
>
>>Thank you, Gord.  I would be interested in a sample of the code.  I have
>>created code before to protect and unprotect a sheet tied to a button or
>>cell, but haven't ever tied it to selecting a table or not.  That may be a
>>useful approach to this problem.  Nevertheless, can you answer the
>>following:
>>
>>As I indicated in the original message, when a worksheet is protected the
>>user can choose options to allow auto-filtering or sorts.  When these
>>options are chosen, why is the program not allowing the user to sort the
>>table using the filter buttons or a sort?  One would infer from the
>>protection options selected that the sort would be allowed!
>>
>>Thanks,
>>
>>Richard
>>
>>****************************
>>"Gord Dibben" <gorddibbATshawDOTca> wrote in message
>>news:nrn1s5ll7fcearto8nv219a2tc39ute4ck@4ax.com...
>>> Generally one has code to unprotect, code to do the sort, then 
>>> re-protect.
>>>
>>> By "tables" do you a real Table created by Insert>Table?
>>>
>>> I can provide code that turns off protection when you click inside a
>>> Table.
>>>
>>> Click outside the Table and protection goes back on.
>>>
>>> Is this something you could work with?
>>>
>>>
>>> Gord Dibben  MS Excel MVP
>>>
>>> On Sat, 10 Apr 2010 14:22:00 -0600, "Blue Max" <mailrichard@msn.com>
>>> wrote:
>>>
>>>>How do we configure our worksheet so that we can turn protection ON, but
>>>>still enable the table filter buttons in order to sort columns in a 
>>>>table?
>>>>
>>>>No matter what settings we select for protection, including the sort and
>>>>auto-filter options, we cannot sort tables on a protected sheet.  What 
>>>>is
>>>>the secret to allowing table sorts on a protected sheet?
>>>
> 

0
Blue
4/29/2010 3:46:44 PM
Reply:

Similar Artilces:

Sorting
Hi, is it possible to use variable for sorting? Something like: declare @sort varchar(10) SET @sort='column1 DESC' SELECT ROW_NUMBER() OVER (ORDER BY @sort)AS rowId, * FROM table Is dynamic SQL only option? Thank you, Simon On 15/04/2010 11:28, simon wrote: > Hi, > > is it possible to use variable for sorting? > > Something like: > > declare @sort varchar(10) > SET @sort='column1 DESC' > > SELECT ROW_NUMBER() OVER (ORDER BY @sort)AS rowId, * FROM table > > Is dynamic SQL only option? You can use CASE to he...

How to sort account list?
I'm using MS Money 2004 Small Business. In the account list, my accounts are catagorized by and in this order: - bank accounts - credit accounts - investment accounts - loans and liabilities - asset accounts TOTAL BALANCE In the above view, I cannot easily determine totals for assets and liabilities. The following view does this. - bank accounts - investment accounts - asset accounts SUBTOTAL -loans and liabilities SUBTOTAL TOTAL BALANCE How do I get the above view? Thanks, Brett I don't use Small Business. But you can run a Net Worth report to get total assets and ...

protected worksheet won't unprotect
Hello-- I have an Excel spreadsheet out on our network which is protected; I need to make changes to it. When I go to make a change it brings up the message "The cell or chart you are trying to change is protected and therefore read- only." It says to remove protection via Tools->Protection- >Unprotect Sheet command. I go to that menu, but the Unprotect option is grayed out. Can anyone please tell me what I'm missing or doing wrong? Thanks! :) LB Hi is this workbook shared?. If yes then this procedure is not possible -- Regards Frank Kabel Frankfurt, Germany ...

Where's the Sort by New Message option?
Not sure when the layout of the newsgroups changed but I can't seem to find the ability to sort by new message in a thread instead of sorting by just the original thread date. That was hugely helpful as I could follow along and see what threads were still active. If you're gonna hang around in the newsgroups (any newsgroups), you may want to start using a newsreader. Microsoft Outlook Express can do it for you. Saved from a previous post: You may want to connect to the ms newsserver directly: If you have Outlook Express installed, try clicking on these links (or copy and paste i...

Row names will not move with sort
Each row in my summary table in Sheet1 is hyperlinked to a corresponding table in Sheet2 with additional details. I need to move the rows in my summary table (Sheet1) and preserve the links to and from the details tables (Sheet2). I found that I can move rows in Sheet1 with cut & insert and the hyperlinks are maintained. I can travel from a row in summary table (Sheet1) to details table (Sheet2) and back, even after the corresponding row (Sheet1) was moved. But if I sort the rows in Sheet1 the links from Sheet2 back to corresponding rows in Sheet1 lead to presorted locations. Apparen...

set default record to a table
I have a shared db with various front ends (mde). I would like to set a paricular record as my default record, so whenever someone opens up the various db forms it opens up to the same default record. Is this possible? Maybe this is a matter of terminology... In Access, data is stored in tables. Each table has it's own records (collections of related data). When you say you want a "record" to be the default one pulled up by everyone, how do you know they are all using their different forms to look at the same data (i.e., table)? Next, why? What is it about ...

Call value from table not form
I am probably overlooking something stupid here but, I need to pull a value from a table when a form is not open? Dim InternalEmail As String InternalEmail = Forms!frmCommitteeEmail!DMEmail this gives an error if the form frmCommitteeEmail is not already open. I am pretty sure that is the problem because if I add code to first open the form it works fine. Any help here will be appreciated. Thanks in advance Dave wrote: > I am probably overlooking something stupid here but, I need to pull a > value from a table when a form is not open? > > Dim InternalEmail As String > I...

sorts not sorting
OK- Thanks to everyones help I now i have a list i can work with... but there are a few problems.... the zips are all 5 digit and now i have to sort them... the problem is, THEY WONT SORT CORRECTLY!!!!!!! The numbers are not in order... some are but a lot are not... is there anyway to fix this???? i need to sort them by zip code but cant seem to get them to do it correctly.. any ideas??? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ You are going to be far better of...

How do I format the tabs of a worksheet in Excel?
I am wondering if there is way to change the font size, font color, or tab color so it is easier to keep my sheets straight. I dont really want to make a table of contents or anything like that, I just need certain sheets to stand out more than others. If you have Excel 02, you can change the colors by right clicking on the tabs, If your version is earlier, you are out of luck "s_e_morin" wrote: > I am wondering if there is way to change the font size, font color, or tab > color so it is easier to keep my sheets straight. I dont really want to make > a table of...

How do I return the table structure using an SQL command in a quer
In a VBA function, I need to fill a combo box with the table fields name. Could you please help me on this? -- Wagner Mokva You've described "how" you are trying to do something. If you'll describe "why" you want to do this, the newsgroup readers may be able to offer more specific suggestions. Regards Jeff Boyce Microsoft Office/Access MVP "Wagner Mokva" <WagnerMokva@discussions.microsoft.com> wrote in message news:40D27041-8E53-4BAB-B31D-C75FA935B28A@microsoft.com... > In a VBA function, I need to fill a combo box with the table fields...

Budget vs. Spending table
I'm switching from Money 2005 to 2007. In the 2005 version, under "Budget Summary" on the left sidebar from the Home page was a link to a report/table called "Budget vs. Spending. The table eas titled "Compare Actual Spending to Your Budget" and near the top had a drop down box to select the time period for the table. Below the table had the actual categories, spending, budget and difference in columns. Order was by category. I can't find this same table/report in 2007. Closest is viewing "Monthly Budget report - similar layout but no time choi...

import- number- sort?
I imported this data into a spread sheet- I tried to format it to number, but when I sort it- I get : 37.08 4.33 4.79 4.8 42.56 5.94 Whats up with this? Thanks Brent Hi Brent, Install the TrimAll macro, select the column and invoke the macro from Alt+F8 http://www.mvps.org/dmcritchie/excel/join.htm#trimall Directions to install and use a macro at http://www.mvps.org/dmcritchie/excel/getstarted.htm#havemacro I expect that you have spaces or CHAR(128) "Required Blank" characters in you data you can check is =LEN(A1) --- HTH, David...

Underlining figures in tables
In the past, whenever a document has had columns of dollar amounts and totals, I've always placed a narrow-width column between each regular column so that when underlining the cells above the "Total," in each column, it would not appear as one straight line spanning several columns. However, I've just taken over a long document from someone else who has underlined the last items in the columns before the totals--and the lines do not extend all across the column; in other words, they look like mine, but without all the trouble I've gone through! Please...

Protecting range limits
Hola, I need help writing code to protect part of a range given a set of limits. Example: on a 5 x 5 matrix, given n=3, I need to protect rows 4,5 and columns 4,5. Given n=2, I need to protect rows and columns 3,4,5. Help is very much appreciated. Regards, OMER ...

Pivot Table
Hi! What is the maximum rows allowed in a data range when using a pivot table? I have a pivot table that uses a data range. When I have only 4581 records in the data range, the pivot table updates with no problems. But, when entering more than 4581, the pivot table won't update and gives me an error. Am I hitting the max on data rows within my data range or is there a work-around. Thanks!! dmotika The following MSKB articles outline PivotTable limitations for different versions of Excel: XL2000: Limits of PivotTables in Microsoft Excel 2000 http://support.microsoft.com/de...

sorting macro #3
I need to sort on 8 cells in a row and on 1500+rows. I can do it one at a time but I know there must be an easier way. Can ANYONE HELP? C3:J3 I need these cells sorted and then down to C1532:J1532 I did create a macro to sort after I selected them but still one at a time. Does it have to be a macro? I can edit a macro but don't really know how to program them. Yes, it has to be a macro. The following should do it. This macro loops through all the entries in Column C, and in each row it sorts the values in Columns C:J. HTH Otto Sub SortRows() Dim rColC As Range Dim i As...

Can we sort a form and also be able to enter new records.
Hi, It is possible to sort the data on a form and also be able to enter new and edit the existing records in it. Cheers! On Tue, 15 Jan 2008 15:41:16 -0800 (PST), Rex wrote: > Hi, > > It is possible to sort the data on a form and also be able to enter > new and edit the existing records in it. > > Cheers! I assume you mean "Is it". The form sort order has nothing to do with editing or adding new records, so the answer is yes. If you cannot edit or add new records, make sure the form's record source, if it is a query, is updateable. Some queries are not. O...

Sorting checking register
How do i sort my check register in Money 2004 Deluxe so that uncleared transactions appear below cleared transactions? In Quicken i could click on the column to provide that sort. In microsoft.public.money, Dean wrote: >How do i sort my check register in Money 2004 Deluxe so >that uncleared transactions appear below cleared >transactions? In Quicken i could click on the column to >provide that sort. You don't. Available choices are chosen by clicking View at the top of the register. ...

using addrress books to sort incoming mail
I use address books to sort incoming mail. An odd thing: depending on how the sender's name comes across, it doesn't get caught by the filter (amd moved to the "Family Mail" Folder I have set up. for example: my mom and dad's email (from momanddad@somedomain.com) comes as from that address. However, in my contacts, they are listed by their names: John and Mary Smith, with momanddad@somedomain.com as their email address and John and Mary Smith as the display name. What have I done wrong? TIA 1. The big ONE - failed to post your version of Outlook. Rules operate at ...

Count records from different table
Not sure if this is even do-able or not. I have a form (lets call it FORM A) that has details information about each Case. Each case can have multiple Collection records. I want text box on FORM A that just tells me the number of Collection records with the same Case number. I tried DCount in a new unbound text box, but i just get '#Error'. Any suggestions? You can use an unbound textbox, and in the form's On Current event open a recordset of the table, then populate the textbox with the recordcount from that recordset. For example, if your other table was called TBL an...

Disabled "Switch Row/Column" when creating chart from a pivot tabl
I have a pivot table where there are week numbers and three different data values pr week. This I want to graph so that the weeks are on the X-axis, the values on the Y-axis and a legend telling which of the three datasets are which. When I create a Line graph the weeks are put as a legend and the X-axis have the three different datasets grouped. This is not what I want. When I go into "the "Select data..." dialog box all the options are disabled. Why is this and how can I get the graph to show the way I want? You will need to pivot your pivot table to move the row fiel...

Pivot Table
In a Excel Pivot Table, when we double-click a cell in the Data area, a new sheet is created with the details. What I want to do (I already did it in the past), is when I click a cell in the Row area, several sheets are created (one per value). I have already had this feature in Excel in the past (I think it was an add-on), but I don't remember how to do it again. Thxs,, Pedro Valente I think you mean from the Page field, not the Row field. From the PT Toolbar>dropdown>Show Pages -- Regards Roger Govier "Valente" <pedro.valente.geral@gmail.com> wrote in messag...

What table is the SOPType lookup table?
I'd like to do a sql join from sop tables and rather then hard code the soptype description such as 2=Order, 3=Invoice, 4=Return, I want the join to return the description by getting it from the sop type lookup table. Can't locate the lookup table. Can someone please send me the lookup table. Thanks. Unfortunatlety there is no lookup table for this information. In the past, I have created my own table to serve as a lookup. The table closest to the information you arer looking for is [SOP40300]. -- Regards Andrew Dean Envisage Software Solutions Pty. Ltd. www.envisa...

protecting format
I have just figured out how to protect the format of cells so that when a date is input it always goes to the same format and font etc, and the format cannot be changed by anyone. However, when a date cell is copied from another excel file to my protected cell it does not revert to my desired format. How can I ensure that whenever anything is pasted into the cell that the format will automatically revert to my desired format? (ie without having to paste special) - (maybe some VB code will do this???) Thank You! One way around this is to just change the number format each time a cell ch...

Unmerge so I can sort
I coy/pasted data into Excell and when I try to sort it I get "This operation requires merged sells to be identically sized". I understadn the work around in KB but how do I find which sells are merged? I wouldn't bother looking. I'd just remove all the merged cells from the range to sort. Select that range format|cells|alignment tab uncheck the merge cells box But if you wanted to search, you can do it via process of elimination. Select a range, format|cells|alignment tab. If that merge cells box is checked, then the whole selection is merged. If it's grey, t...