Sorting a password protected sheet

marcidee

Board Regular
Joined
May 23, 2016
Messages
196
Office Version
  1. 2019
Just wondering if someone can help with a VBA script to sort a password protected sheet. The sort will be on a table (called stocktable) that at present is A2 to N29 (row 1 is the table headers) - more rows will be added above row 30 (row 30 contains totals that should be part of the sort) so the macro will need to take this into account.

Thank you for your help.

Marc

StockNameStatusItem CostMark upSale PriceOpening StockNew PurchasesTotal Purchased StockSoldStockValue of Stock
Amazon EchoActive
£17.00​
£17.00​
20​
0​
20​
0​
20​
340​
Anker NebulaActive
£319.99​
£319.99​
1​
0​
1​
0​
1​
320​
BaByliss Berry Crush StraightenerActive
£28.00​
£28.00​
2​
0​
2​
0​
2​
56​
Baylis & Harding Jojoba, Vanilla & Almond Oil Luxury Bathing Duo Stack Gift Box Gift Set - Vegan Friendly…Active
£7.49​
£7.49​
10​
0​
10​
0​
10​
75​
Bush Big LED Alarm Clock RadioActive
£14.99​
£14.99​
0​
3​
3​
0​
3​
45​
Canon MG3650S WH…Active
£39.99​
£39.99​
1​
0​
1​
0​
1​
40​
Canon PIXMA TS5151 3-in-1 Printer - White…Active
£59.00​
£59.00​
2​
0​
2​
0​
2​
118​
CLARINS Body Care Set 3PcActive
£23.10​
£23.10​
0​
3​
3​
0​
3​
57​
Clementoni 39411 Clementoni-39411-Impossible Puzzle-Marvel-1000 Pieces, Multi-ColourActive
£7.50​
£7.50​
4​
0​
4​
0​
4​
30​
Corsair 163301 Vengeance LPX 32 GB (2 x 16 GB) DDR4 3200 MHz C16 XMP 2.0 High Performance Desktop Memory Kit, Black…Active
£98.35​
£98.35​
0​
2​
2​
0​
2​
197​
Epson ScannerActive
£89.99​
£89.99​
10​
0​
10​
0​
10​
900​
Gorilla GlueActive
£3.30​
£3.30​
1​
0​
1​
0​
1​
3​
Heroes of Goo Jit Zu SUPAGOO DINO…Active
£10.00​
£10.00​
1​
0​
1​
0​
1​
10​
LEGO 21165 Minecraft The Bee Farm VillageActive
£13.50​
£13.50​
1​
0​
1​
0​
1​
14​
MAJORITY Girton II Mains Powered & Portable Radio | FM + DAB Radio | Dual Alarm | Stereo Speakers…Active
£29.70​
£29.70​
0​
6​
6​
0​
6​
178​
MNG01710 Monsterverse Godzilla vs Kong 6" Hollow Earth Monsters Warbat w/Osprey…Active
£10.99​
£10.99​
2​
0​
2​
0​
2​
22​
MonsterVerse MNG01610 Godzilla vs Kong 6" Hollow Earth Monsters MechaGodzilla…Active
£10.99​
£10.99​
2​
0​
2​
0​
2​
22​
PAW Patrol Dino Rescue Rex’s Transforming Vehicle with Mystery Dinosaur Figure…Active
£15.00​
£15.00​
3​
0​
3​
0​
3​
45​
Pixi Best of Vitamin C- Mask, Toner & Moisturiser…Active
£9.99​
£9.99​
0​
7​
7​
0​
7​
70​
Sensodyne Pronamel Mint Essence Fluoride Toothpastes…Active
£7.15​
£7.15​
0​
13​
13​
0​
13​
93​
Smiggle Pencil Case Hardtop 'Shimmy' with Reversible Sequins (Pink/Purple)Active
£6.00​
£6.00​
0​
12​
12​
0​
12​
72​
Soap And Glory Sexy Mother Pucker PLUMSUP Lip Plumping Gloss 7ml…Active
£6.10​
£6.10​
0​
20​
20​
0​
20​
122​
TENA for Men Premium Fit Level 4 Medium Pack of 10…Active
£0.00​
£0.00​
0​
1​
1​
0​
1​
0​
Wahl Colour Pro Cordless Clipper, Hair Clippers for Men, Head Shaver, Men's Hair ClippersActive
£19.00​
£19.00​
1​
0​
1​
1​
0​
0​
ZURU 38360 Balloons Slide 1 Lane with 3 Bunches BOB Recycled Material, Assorted Designs and Colours…Active
£10.00​
£10.00​
1​
0​
1​
0​
1​
10​
Insert rows here
62​
1​
2838​
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi Marcide, what you mean about "Sorting a password protected sheet" I still not get the point from your expectation, can you describe a little bit specific ;)
 
Upvote 0
Hi Eddorena

The table above is in a sheet that is password protected - the protection restricts various cells from being edited and formulas are hidden.

However as rows and items are added I would like the table to be sorted by column A.

Whilst the sheet is protected the table cannot be sorted and the sort button is greyed out.

I am hoping that a macro can be written that will sort the table (by column A (not including the total row at the bottom)) without having to unprotect the sheet (and without having to type the password in).
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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