ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need macro for protecting individual rows in a worksheet (https://www.excelbanter.com/excel-programming/366265-need-macro-protecting-individual-rows-worksheet.html)

Sri Ram

Need macro for protecting individual rows in a worksheet
 
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?

markwalling

Need macro for protecting individual rows in a worksheet
 
if you look at an individual cell's properties, there is a locked
checkbox on the last page. that is set by default, locking the cell
when the sheet is protected. clearing that would allow the cell to be
edited on a protected sheet.

hope that gave you the insight you need.

Sri Ram wrote:
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?



Chip Pearson

Need macro for protecting individual rows in a worksheet
 
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?




Chip Pearson

Need macro for protecting individual rows in a worksheet
 
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?






Sri Ram[_2_]

Need macro for protecting individual rows in a worksheet
 
Well Chip, do u know how to do this using VBA code.

"Chip Pearson" wrote:

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?





Chip Pearson

Need macro for protecting individual rows in a worksheet
 
See my reply to my post.


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


"Sri Ram" wrote in message
...
Well Chip, do u know how to do this using VBA code.

"Chip Pearson" wrote:

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?







Sri Ram[_2_]

Need macro for protecting individual rows in a worksheet
 
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?







Chip Pearson

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?









All times are GMT +1. The time now is 11:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com