LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Need macro for protecting individual rows in a worksheet

The sheet must not be protected when you run the code. Try this:

Sub AAA()
ActiveSheet.Unprotect
Cells.Locked = False
Rows(1).Locked = True
Rows(3).Locked = True
Rows(5).Locked = True
ActiveSheet.Protect
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Sri Ram" wrote in message
...
I tried it but I am getting the error "Unable to set the locked
property of
the range class"

"Chip Pearson" wrote:

If you need this in VBA, use code like the following:

Sub AAA()
Cells.Locked = False
Rows(1).Locked = True
Rows(3).Locked = True
Rows(5).Locked = True
ActiveSheet.Protect
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Chip Pearson" wrote in message
...
By default, all cells are Locked, so when you protect the
sheet, all cells are protect. Click on the Select All button
(the gray box above the row numbers, to the left of the
column
letters), go to the Edit menu, choose Cells, the protection
tab, and uncheck the Locked setting. Then, select the rows
you
want to protect, go back to the Format dialog and check
Locked.
Finally, protect your sheet.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Sri Ram" <Sri wrote in
message
...
I have a concept in my project i which I have make some rows
of
a worksheet
non-editable .i.e., read-only. I have tried many options
but
everything gave
me error. I can protect a complete worksheet but not
individual rows. I would
like to know whether it is possible to protect certain rows
of
a worksheet &
if so, what is the function to use?







 
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
Protecting/locking individual cells? + not displaying #N/A on cel MikeR-Oz New Users to Excel 3 September 10th 08 03:28 PM
protecting individual cells MedTech Excel Discussion (Misc queries) 4 December 20th 06 02:21 PM
protecting individual cells MedTech Excel Discussion (Misc queries) 1 December 19th 06 07:12 PM
Auto run macro on individual worksheet open mr_teacher[_2_] Excel Programming 2 May 11th 06 10:15 PM
Protecting individual sheets debra Excel Discussion (Misc queries) 0 December 6th 05 06:21 PM


All times are GMT +1. The time now is 04:53 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"