Sorting a table in a protected sheet when some cells are locked -MACRO needed

GMC The Macro Man

Board Regular
Joined
Mar 23, 2023
Messages
104
Office Version
  1. 2021
Platform
  1. Windows
Hi Guys, I'm looking for some help here

I have a large Data Table with some of the columns LOCKED to protect the formulas in them. The worksheet is also protected so the users cannot "screw up" the formulas.
The issue i have is when the users add new data to the bottom rows, they cannot DATA SORT it as the sheet is protected :(.
I have read through this forum and many youtube sites and it seems you cannot DATA SORT on a protected sheet so a MACRO is needed.
I created a MACRO to
1. Un-protect the worksheet with the password
2. Run the DATA SORT
3. Protect the sheet with the password.
The issue here is when I run it, i get a pop up to input the password. Is it possible to embed the password in to the macro? Also, I would need the password to be hidden from the users. Is that possible too?
Many Thanks
GMC
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
You can allow sorting on a protected sheet. You can't, however, add rows to a table on a protected sheet, so I'm a little confused by your question.

As regards your macro, the one argument that you can pass to Unprotect is the password so just add that to the code.
 
Upvote 0
You can allow sorting on a protected sheet. You can't, however, add rows to a table on a protected sheet, so I'm a little confused by your question.

As regards your macro, the one argument that you can pass to Unprotect is the password so just add that to the code.
Hi RoryA, thanks for coming back to me.
I have a few columns in this table that have formulas so firstly I "Lock and Hide" theses cells using the "Protection" within the "Format Cells" option.
1723713868656.png

I then have to protect the worksheet as the columns with the formulas need to be locked but most importantly hidden as I do not want the client to see my calculations.
The client can add data at the first available row at bottom of the table as normal but the issue i have is not to SORT or FILTER as I can already do this, but it is to DATA SORT the table so it puts in the order according to the screenshot below
The sheet is sorted by Year Group/Class/Forename.

1723714326712.png


I hope this makes sense

Wishaw TEST Macro.xlsm
ABCDEF
8SCNForenameSurnameFull NameYear GroupClass
9241474577AJParker SinclairAJ Parker SinclairP1P1
10241499499AlisonSanghaAlison SanghaP1P1
11241499405AllegraMacdonaldAllegra MacdonaldP1P1
12241499472AlythPortAlyth PortP1P1
13241499561AmeliaReidAmelia ReidP1P1
14241499340Anna-RoseYounisAnna-Rose YounisP1P1
15241499553AryahLaffertyAryah LaffertyP1P1
16241499308AvaLoveAva LoveP1P1
17241499480AyrtonSinclairAyrton SinclairP1P1
18241499421BlairKennedyBlair KennedyP1P1
Pupil Data
Cell Formulas
RangeFormula
D9:D18D9=IF([@Forename]&[@Surname]="","",[@Forename]&" "&[@Surname])
 
Upvote 0
I'm still confused as a table on a protected sheet will not automatically expand to include new data, but I think I already answered your macro question anyway.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,177
Members
452,615
Latest member
bogeys2birdies

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