Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
enginguven
 
Posts: n/a
Default How can I lock worksheets while still allowing macros to operate?


  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default How can I lock worksheets while still allowing macros to operate?

If you protect your sheet in code, you can allow your code to do things that
users can't.

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

It needs to be reset each time you open the workbook. (excel doesn't remember
it after closing the workbook. That's why I used auto_open/workbook_open.)

But there are still a few things that won't work as code.

If you run into that, you could always unprotect the worksheet, run your stuff,
and reprotect the worksheet.

(You could always do that second suggestion no matter what.)

enginguven wrote:

--

Dave Peterson
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
Hide worksheets if macros are disable Eintsein_mc2 Excel Discussion (Misc queries) 2 September 17th 05 07:37 PM
macros affecting different worksheets CJW Excel Discussion (Misc queries) 1 September 2nd 05 04:29 PM
Unhide Worksheets (hidden via macros) Mark Excel Discussion (Misc queries) 1 June 7th 05 05:21 PM
Can a formula operate between worksheets, ie collating info from . Andy Excel Worksheet Functions 1 March 8th 05 05:30 AM
HELP! How do you--> Lock a set of rows but also link worksheets to FRUSTRATED Excel Discussion (Misc queries) 6 December 29th 04 10:05 PM


All times are GMT +1. The time now is 05:21 PM.

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

About Us

"It's about Microsoft Excel"