qwerty1234
New Member
- Joined
- Dec 9, 2014
- Messages
- 20
I have a protected workbook that I cannot allow other users to edit. However, there are several other people who require the information on the spreadsheet, which is why it is protected. Unfortunately, due to Excel failure's apparently, Excel will not allow the users to sort the different columns without unlocking those columns, which I cannot allow as it will give those users access to change the data.
I will be the first to admit that I'm not great with Macros. I tried to write a code that would allow a user to sort the sheet without unlocking the cells, but I don't know how to do it for all columns. Instead, I was thinking of using a combo box as a drop down to allow the users to sort the columns that way. The drop down would list the different column headers, and then the user can select which one they want, then ascending or descending, and a macro would do the sorting for them.
Is this an option? And is there someone who could help me with the coding? Or does someone have a code that would automatically unprotect the sheet, sort the column in question, and then reprotect the sheet without having to activate a macro (most of these user's no nothing about coding)? I know I'm not the first person to run into this issue.
This is the kind of data I'm looking at:
[TABLE="width: 756"]
<colgroup><col width="108" span="7" style="width:81pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 108"]contract[/TD]
[TD="class: xl65, width: 108"]part number[/TD]
[TD="class: xl65, width: 108"]item name[/TD]
[TD="class: xl65, width: 108"]quantity[/TD]
[TD="class: xl65, width: 108"]cost[/TD]
[TD="class: xl65, width: 108"]due date[/TD]
[TD="class: xl65, width: 108"]supplier[/TD]
[/TR]
[TR]
[TD="class: xl65"]a[/TD]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]soup[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]2.5[/TD]
[TD="class: xl66"]3/15/2015[/TD]
[TD="class: xl65"]Costco[/TD]
[/TR]
[TR]
[TD="class: xl65"]b[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]beef[/TD]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]3.4[/TD]
[TD="class: xl66"]3/18/2015[/TD]
[TD="class: xl65"]Big Y[/TD]
[/TR]
[TR]
[TD="class: xl65"]c[/TD]
[TD="class: xl65"]3[/TD]
[TD="class: xl65"]bread[/TD]
[TD="class: xl65"]3[/TD]
[TD="class: xl65"]3.1[/TD]
[TD="class: xl66"]3/11/2015[/TD]
[TD="class: xl65"]Big Y[/TD]
[/TR]
[TR]
[TD="class: xl65"]d[/TD]
[TD="class: xl65"]4[/TD]
[TD="class: xl65"]water[/TD]
[TD="class: xl65"]7[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl66"]3/29/2015[/TD]
[TD="class: xl65"]Price Chopper[/TD]
[/TR]
[TR]
[TD="class: xl65"]e[/TD]
[TD="class: xl65"]5[/TD]
[TD="class: xl65"]milk[/TD]
[TD="class: xl65"]4[/TD]
[TD="class: xl65"]3[/TD]
[TD="class: xl66"]4/1/2015[/TD]
[TD="class: xl65"]Stop N Shop[/TD]
[/TR]
[TR]
[TD="class: xl65"]b[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]beef[/TD]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]3.4[/TD]
[TD="class: xl66"]4/18/2015[/TD]
[TD="class: xl65"]Big Y[/TD]
[/TR]
[TR]
[TD="class: xl65"]b[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]beef[/TD]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]3.4[/TD]
[TD="class: xl66"]3/18/2015[/TD]
[TD="class: xl65"]Big Y[/TD]
[/TR]
[TR]
[TD="class: xl65"]d[/TD]
[TD="class: xl65"]4[/TD]
[TD="class: xl65"]water[/TD]
[TD="class: xl65"]7[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl66"]5/1/2015[/TD]
[TD="class: xl65"]Price Chopper[/TD]
[/TR]
[TR]
[TD="class: xl65"]a[/TD]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]soup[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]2.5[/TD]
[TD="class: xl66"]4/10/2015[/TD]
[TD="class: xl65"]Costco[/TD]
[/TR]
</tbody>[/TABLE]
So I can't have the users changing the part number, cost, due date, etc., but I want them to be able to sort by any of those columns.
Any help would be appreciated.
I will be the first to admit that I'm not great with Macros. I tried to write a code that would allow a user to sort the sheet without unlocking the cells, but I don't know how to do it for all columns. Instead, I was thinking of using a combo box as a drop down to allow the users to sort the columns that way. The drop down would list the different column headers, and then the user can select which one they want, then ascending or descending, and a macro would do the sorting for them.
Is this an option? And is there someone who could help me with the coding? Or does someone have a code that would automatically unprotect the sheet, sort the column in question, and then reprotect the sheet without having to activate a macro (most of these user's no nothing about coding)? I know I'm not the first person to run into this issue.
This is the kind of data I'm looking at:
[TABLE="width: 756"]
<colgroup><col width="108" span="7" style="width:81pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 108"]contract[/TD]
[TD="class: xl65, width: 108"]part number[/TD]
[TD="class: xl65, width: 108"]item name[/TD]
[TD="class: xl65, width: 108"]quantity[/TD]
[TD="class: xl65, width: 108"]cost[/TD]
[TD="class: xl65, width: 108"]due date[/TD]
[TD="class: xl65, width: 108"]supplier[/TD]
[/TR]
[TR]
[TD="class: xl65"]a[/TD]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]soup[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]2.5[/TD]
[TD="class: xl66"]3/15/2015[/TD]
[TD="class: xl65"]Costco[/TD]
[/TR]
[TR]
[TD="class: xl65"]b[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]beef[/TD]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]3.4[/TD]
[TD="class: xl66"]3/18/2015[/TD]
[TD="class: xl65"]Big Y[/TD]
[/TR]
[TR]
[TD="class: xl65"]c[/TD]
[TD="class: xl65"]3[/TD]
[TD="class: xl65"]bread[/TD]
[TD="class: xl65"]3[/TD]
[TD="class: xl65"]3.1[/TD]
[TD="class: xl66"]3/11/2015[/TD]
[TD="class: xl65"]Big Y[/TD]
[/TR]
[TR]
[TD="class: xl65"]d[/TD]
[TD="class: xl65"]4[/TD]
[TD="class: xl65"]water[/TD]
[TD="class: xl65"]7[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl66"]3/29/2015[/TD]
[TD="class: xl65"]Price Chopper[/TD]
[/TR]
[TR]
[TD="class: xl65"]e[/TD]
[TD="class: xl65"]5[/TD]
[TD="class: xl65"]milk[/TD]
[TD="class: xl65"]4[/TD]
[TD="class: xl65"]3[/TD]
[TD="class: xl66"]4/1/2015[/TD]
[TD="class: xl65"]Stop N Shop[/TD]
[/TR]
[TR]
[TD="class: xl65"]b[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]beef[/TD]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]3.4[/TD]
[TD="class: xl66"]4/18/2015[/TD]
[TD="class: xl65"]Big Y[/TD]
[/TR]
[TR]
[TD="class: xl65"]b[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]beef[/TD]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]3.4[/TD]
[TD="class: xl66"]3/18/2015[/TD]
[TD="class: xl65"]Big Y[/TD]
[/TR]
[TR]
[TD="class: xl65"]d[/TD]
[TD="class: xl65"]4[/TD]
[TD="class: xl65"]water[/TD]
[TD="class: xl65"]7[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl66"]5/1/2015[/TD]
[TD="class: xl65"]Price Chopper[/TD]
[/TR]
[TR]
[TD="class: xl65"]a[/TD]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]soup[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]2.5[/TD]
[TD="class: xl66"]4/10/2015[/TD]
[TD="class: xl65"]Costco[/TD]
[/TR]
</tbody>[/TABLE]
So I can't have the users changing the part number, cost, due date, etc., but I want them to be able to sort by any of those columns.
Any help would be appreciated.