Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DFS DFS is offline
external usenet poster
 
Posts: 5
Default Turn protection Off... <run code... turn protection back on

I'm building a fairly locked-down Excel system (no sorting, no insert/delete
rows, lots of locked cells, etc) that will find its way into the hands of
end-users, and I'm finding most operations are requiring me to turn
protection off, then run the routine, then turn protection back on.

Is there a better way?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Turn protection Off... <run code... turn protection back on

Depends on what you're doing.

Somethings code can do that the user can't -- if you protect the worksheet in
code.

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
End With
End Sub

I used the Auto_Open procedure (in a General module) because excel doesn't
remember this setting. It has to be run each time the workbook is opened--or at
least before you can expect your code to do something to that protected
worksheet.

But there are some things that even the code can't do and you have to use what
you're using now.

DFS wrote:

I'm building a fairly locked-down Excel system (no sorting, no insert/delete
rows, lots of locked cells, etc) that will find its way into the hands of
end-users, and I'm finding most operations are requiring me to turn
protection off, then run the routine, then turn protection back on.

Is there a better way?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
DFS DFS is offline
external usenet poster
 
Posts: 5
Default Turn protection Off... <run code... turn protection back on

Dave Peterson wrote:
Depends on what you're doing.

Somethings code can do that the user can't -- if you protect the
worksheet in code.

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
End With
End Sub

I used the Auto_Open procedure (in a General module) because excel
doesn't remember this setting. It has to be run each time the
workbook is opened--or at least before you can expect your code to do
something to that protected worksheet.

But there are some things that even the code can't do and you have to
use what you're using now.



Thanks Dave. I'll look into that setting.

Occasionally I'm using "hidden" cells (white font that can't be seen) that
say On or Off, but I hate obscure/kludges like that.




DFS wrote:

I'm building a fairly locked-down Excel system (no sorting, no
insert/delete rows, lots of locked cells, etc) that will find its
way into the hands of end-users, and I'm finding most operations are
requiring me to turn protection off, then run the routine, then turn
protection back on.

Is there a better way?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Turn protection Off... <run code... turn protection back on

I use something similar to Dave Peterson, but it only unlocks the worksheet
when a piece of code needs to update the sheet, and then it protects it again
after making the update.

Write procedures that do nothing but protect and unprotect your current
worksheet. Then I simply call those procedures from other procedures that
are updating the worksheet after some calculations.

This keeps end users from making a mess of things.
--
Mark Trevithick


"DFS" wrote:

I'm building a fairly locked-down Excel system (no sorting, no insert/delete
rows, lots of locked cells, etc) that will find its way into the hands of
end-users, and I'm finding most operations are requiring me to turn
protection off, then run the routine, then turn protection back on.

Is there a better way?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Turn filters off and back on ALV Excel Programming 2 January 25th 07 04:57 PM
turn an filter off or back to All Dennis Excel Programming 1 November 9th 06 08:22 AM
How do I turn protection on/off with Combo boxes P. Graven Excel Programming 1 June 3rd 04 05:36 PM
auto turn off macro virus protection DEL Excel Programming 3 October 9th 03 01:26 PM
Code to automatically turn on and turn off Track Changes John[_46_] Excel Programming 1 October 7th 03 02:22 AM


All times are GMT +1. The time now is 02:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"