Go Back  PPRuNe Forums > Misc. Forums > Computer/Internet Issues & Troubleshooting
Reload this Page >

Excel - Sorting In A Protected Worksheet

Wikiposts
Search

Notices
Computer/Internet Issues & Troubleshooting Anyone with questions about the terribly complex world of computers or the internet should try here. NOT FOR REPORTING ISSUES WITH PPRuNe FORUMS! Please use the subforum "PPRuNe Problems or Queries."

Excel - Sorting In A Protected Worksheet

Thread Tools
 
Search this Thread
 
Old 21st September 2004 | 00:59
  #1 (permalink)  
Thread Starter
 
Joined: Sep 1998
Posts: 513
Likes: 0
From: Sydney, Australia
Excel - Sorting In A Protected Worksheet

I've written an Excel spreadsheet that contains a macro to sort a range of cells. Everything works as intended - so far so good.

I want to protect my intellectual property and I can do that by Protecting the worksheet. However you can't do the sort unless the worksheet is unprotected. That's easy IF YOU DON'T USE A PASSWORD. You can unprotect the sheet first thing in the macro, sort it, then re-protect it last thing.

Protection without a password is basically useless - all it does is inhibit inadvertent alteration of formulas. Anyone can defeat it from the menu with Tools|Protection|Unprotect - in fact that is what my current macro does prior to sorting, then restores protection in a similar way afterwards. Once Protection is off, of course, anyone can access the whole design of the spreadsheet and rip you off!

What I want to do is have a password-protected worksheet that allows sorting of a range without removing the protection first.

When you apply protection one of the check-boxes is Allow users of this worksheet to Sort. I've checked that, but it doesn't solve my problem - the macro won't run and the debugger reports that protected cells are the problem.

I'm missing something somewhere, can't find it in my searches of both Help and MS Knowledgebase, so if anyone has the answer I'd sure appreciate it.

Cheers

AA
Ausatco is offline  
Old 22nd September 2004 | 09:37
  #2 (permalink)  
Chief Tardis Technician
 
Joined: Jan 2001
Posts: 554
Likes: 0
From: Western Australia S31.715 E115.737
No answer for you on this, but i seem to have seen this same question on the work network.
Avtrician is offline  
Old 22nd September 2004 | 10:04
  #3 (permalink)  
 
Joined: Oct 2000
Posts: 779
Likes: 0
From: Sunny Sussex
Congrats on spotting yet another shortcomig in excel. The more you use it, the more you bump up against things it won't do.

The obvious answer is write a vb script to allow you to protect & enable sorting, but easier said than done I'm afraid.
Parapunter is offline  
Old 22nd September 2004 | 12:07
  #4 (permalink)  
20 Anniversary
 
Joined: Mar 2003
Posts: 195
Likes: 2
From: Aus
AA.

You need to add the command

ActiveSheet.Unprotect "xxxx"

at the start of your sorting macro

and the command

ActiveSheet.Protect "xxxx"

at the end. xxx is the password for the sheet protection.

Then to stop people from seeing your password you need to protect the VB code.

In Excel 2000 this is done from the VB editor. Rt click on the Modules folder and select VBAProject Properties On the Protection tab tick the "Lock project for viewing" and enter/re-enter a password.

XP may be slightly different.

Let me know if this helps

MAx
Agent86 is offline  
Old 23rd September 2004 | 06:44
  #5 (permalink)  
Thread Starter
 
Joined: Sep 1998
Posts: 513
Likes: 0
From: Sydney, Australia
Agent86,

You are a saint

Thank you very much

Parapunter, the problem is not so much what Excel cannot do, it is more that I don't know how to make it do it.


AA
Ausatco is offline  
Old 23rd September 2004 | 06:46
  #6 (permalink)  
20 Anniversary
 
Joined: Mar 2003
Posts: 195
Likes: 2
From: Aus
AA


That was a different TV program

Any time

MAx
Agent86 is offline  
Old 23rd September 2004 | 11:52
  #7 (permalink)  

Spicy Meatball
 
Joined: Jan 2004
Posts: 1,115
Likes: 0
From: Liverpool UK
As an analyst I use excel quite a bit - and god dam it can even make the tea for you in the morning, but you need to know how !
mazzy1026 is offline  

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Contact Us - Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service

Copyright © 2026 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.