Protect sort

CHSLax60

New Member
Joined
Jun 6, 2011
Messages
15
Here is my scenario. I have multiple people who need to enter and edit data in a worksheet. However, instead of just filtering to find what they need, people are sorting to find the things they need to edit BUT they aren't including all of the colunms when they sort. This is corrupting the data.

Protecting cells isn't the issue; besides they need to have the ability to edit all of the cells and save their changes. I basically need to protect the function. Is there a way to NOT allow people to resort the file but still allow them to filter it?

A second option would be that I can turn on the filter then if I could just hide the entire ribbon that would work as well.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
When you turn on worksheet protection, you can specify as to whether or not the user can use autofilter and whether on not they can sort. So that might work for you. Do note that in my testing (on Excel 2010), Excel doesn't behave as I would expect. Even though you set to allow user of Autofilter, the Autofilter command is disabled. You would have to turn on filtering before protecting the worksheet.

Having said that, generally this problem is caused by the existence of blank rows in a data block. If a block of data is all related then there should be NO blank rows or blank columns. If a user attempt to select only certain columns and sort them and there is contiguous non-selected data, the user will get a warning. My first solution would be to simply check for blank columns and remove any, if found.
 
Upvote 0
To hide the ribbon

Code:
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""RIBBON"", FALSE)"
 
Upvote 0
Didn't know that one, Peter.

I'd use the trick Peter's showing you as a last resort. Users tend to get a little peeved if you start wiping out their interface. (Unless you're good enough to create a class module that intercepts workbook activation events and toggle ribbon visibility based on which WB is active. But, if you knew how to do that, you probably wouldn't be asking questions about ws protection issues. :wink: )
 
Upvote 0
Hiya Greg :)

An alternative

Code:
Sub hide_unhide_Ribbons()
Application.SendKeys ("^{F1}")
End Sub

which may or not work.

Credit for the first one goes to Andy Pope.
 
Upvote 0
Peter,

Your first solution would work in that it also kills the Alt+D+F+F shortcut option. Simply using Ctrl+F1, only toggles the ribbon's "peek-a-boo" bit. So the keystroke shortcut remains available.
 
Upvote 0
When you turn on worksheet protection, you can specify as to whether or not the user can use autofilter and whether on not they can sort. So that might work for you. Do note that in my testing (on Excel 2010), Excel doesn't behave as I would expect. Even though you set to allow user of Autofilter, the Autofilter command is disabled. You would have to turn on filtering before protecting the worksheet.

Having said that, generally this problem is caused by the existence of blank rows in a data block. If a block of data is all related then there should be NO blank rows or blank columns. If a user attempt to select only certain columns and sort them and there is contiguous non-selected data, the user will get a warning. My first solution would be to simply check for blank columns and remove any, if found.

Thanks Greg but this is also making it to where they can't enter new data or edit the current date which they need to be able to do. Maybe there is a step I'm missing.
 
Upvote 0
Yes, the step you missed was to get smarter help. You did say you need them to edit and enter data, which protection is going to prohibit since there's no way to allow users to change values but not to sort using built-in protection.

Again - the primary solution would be ensure that there are no blank columns. Are there blank columns?
 
Upvote 0
Yes, the step you missed was to get smarter help. You did say you need them to edit and enter data, which protection is going to prohibit since there's no way to allow users to change values but not to sort using built-in protection.

Again - the primary solution would be ensure that there are no blank columns. Are there blank columns?


The problem is that it apears that some of the people (for whatever reason) are sorting they are only selecting 3 or 4 of the 7 columns that contain data. Why? I have no clue.

Now as for the first solution. Am I to take your comment after the first one to mean that this will disable the ribbon on the users computer even after this workbook is no longer active? If so, that would be a deal breaker. Is this true for the second one as well or is that one affecting the users application only while this workbook is open.

What about just hiding or disabling only the "sort filter" button?
 
Upvote 0
Hmmm, I searched here and perused some threads and they all basically say the same thing - using the built-in protection to prevent sorting.

If killing any blank columns and a bit of user education fails, then really about the only idea that occurs to me is the old "hotkey to edit" system where you turn on protectoin and then define a macro that will unprotect he sheet and use SENDKEYS to sent an F2 keystroke to put the user into edit mode. You then tie this macro to a hotkey (like Ctrl+E or something).

Or you can use the ONKEY to intercept F2, but that's a litte more involved.

Then you use the SELECTIONCHANGE event handler to restore protection.
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,628
Members
452,933
Latest member
patv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top