Excel 2000 Worksheet Protection

  • Thread starter Thread starter James
  • Start date Start date
J

James

Hi,

I am using the following code to protect the active worksheet:

Excel.Worksheet activeWorkSheet = (Excel.Worksheet)
excelApp.ActiveWorkbook.ActiveSheet;

activeWorkSheet.Protect("password", missing, missing, missing,
missing);

This works fine but i would like to unprotect certain cells so they do
not require the user to unprotect the worksheet before editing.

Any ideas ?

TIA

Luke
 
Luke,

I don't believe that this level of granularity exists. If you protect
the whole worksheet, then I would expect that everything in the worksheet is
protected. If anything, I would put the cells on another worksheet that is
not protected.

Hope this helps.
 
Sure you can.

Select your range that you want unprotected (I believe by default that cells
are locked) and
then call Select() on that range. Then set Selection.Locked = false, and the
protect the worksheet.

Nicholas Paldino said:
Luke,

I don't believe that this level of granularity exists. If you protect
the whole worksheet, then I would expect that everything in the worksheet is
protected. If anything, I would put the cells on another worksheet that is
not protected.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

James said:
Hi,

I am using the following code to protect the active worksheet:

Excel.Worksheet activeWorkSheet = (Excel.Worksheet)
excelApp.ActiveWorkbook.ActiveSheet;

activeWorkSheet.Protect("password", missing, missing, missing,
missing);

This works fine but i would like to unprotect certain cells so they do
not require the user to unprotect the worksheet before editing.

Any ideas ?

TIA

Luke
 
Back
Top