PC Review


Reply
Thread Tools Rate Thread

Cell Protection vs. Worksheet Protection

 
 
=?Utf-8?B?a213aGl0dA==?=
Guest
Posts: n/a
 
      22nd Sep 2006
Is there anyway to protect selected cells from editing without having to
protect the entire worksheet? I know that I can lock or unlock certain cells
when I protect the worksheet as a whole, but when I use worksheet protection,
it interferes with some of my code and user functionality.... Please
advise...

Thanks,

Kevin
 
Reply With Quote
 
 
 
 
Ken Johnson
Guest
Posts: n/a
 
      22nd Sep 2006

kmwhitt wrote:
> Is there anyway to protect selected cells from editing without having to
> protect the entire worksheet? I know that I can lock or unlock certain cells
> when I protect the worksheet as a whole, but when I use worksheet protection,
> it interferes with some of my code and user functionality.... Please
> advise...
>
> Thanks,
>
> Kevin


Hi Kevin,

Change your code so that it unprotects the sheet, makes its changes,
then protects the sheet.

Eg...

Public Sub CodeForProtection()
With Sheet1
..Unprotect "ken"
..Range("A1").Value = 1
..Protect "ken"
End With
End Sub

If you are not using a password then you just use .Unprotect and
..Protect on their own.

Ken Johnson

 
Reply With Quote
 
=?Utf-8?B?a2Fzc2ll?=
Guest
Posts: n/a
 
      22nd Sep 2006
That's the only way! However, macros can also unprotect and reprotect your
worksheet.

"kmwhitt" wrote:

> Is there anyway to protect selected cells from editing without having to
> protect the entire worksheet? I know that I can lock or unlock certain cells
> when I protect the worksheet as a whole, but when I use worksheet protection,
> it interferes with some of my code and user functionality.... Please
> advise...
>
> Thanks,
>
> Kevin

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      22nd Sep 2006
Depending on what your code does, you can protect the worksheet in code.

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

The userinterfaceonly means that you're stopping the user from changing locked
cells on a protected worksheet (Sheet1, in my example). But your code can
change things that the user can't.

But do some testing. There are a few things that still need you to unprotect
the worksheet, do your stuff, and protect the worksheet. (But maybe you're not
doing one of those few things.)

kmwhitt wrote:
>
> Is there anyway to protect selected cells from editing without having to
> protect the entire worksheet? I know that I can lock or unlock certain cells
> when I protect the worksheet as a whole, but when I use worksheet protection,
> it interferes with some of my code and user functionality.... Please
> advise...
>
> Thanks,
>
> Kevin


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?a213aGl0dA==?=
Guest
Posts: n/a
 
      24th Sep 2006
Thanks for all your help, guys!

"kmwhitt" wrote:

> Is there anyway to protect selected cells from editing without having to
> protect the entire worksheet? I know that I can lock or unlock certain cells
> when I protect the worksheet as a whole, but when I use worksheet protection,
> it interferes with some of my code and user functionality.... Please
> advise...
>
> Thanks,
>
> Kevin

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet Security/Cell Protection =?Utf-8?B?TUxL?= Microsoft Excel Worksheet Functions 2 8th Mar 2007 10:47 AM
Worksheet protection is gone and only wokbook protection can be se =?Utf-8?B?RXJpYyBDLg==?= Microsoft Excel Misc 4 2nd May 2006 04:50 PM
Trouble with Cell/Worksheet Protection... =?Utf-8?B?ams=?= Microsoft Excel Misc 1 23rd Jan 2006 12:46 PM
Cell Protection Within a Worksheet Jeffrey Kearns via OfficeKB.com Microsoft Excel Programming 2 5th Apr 2005 07:00 PM
Worksheet/Cell Protection maacmaac Microsoft Excel Misc 1 16th Dec 2003 06:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:54 AM.