ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Locking cells (https://www.excelbanter.com/excel-discussion-misc-queries/151627-locking-cells.html)

Andy_Trow

Locking cells
 
I have created a table that I only want to enter data into one row. How can I
lock the other cells so they can't be edited, by myself or others. I may in
the future want to go and edit the locked cells at a later date.

bj

Locking cells
 
select the row you want to be able to edit
format-cells-protection
unclick locked
select OK
Tools- protection
select protect sheet
you don't have to use a pass word, unless you think someone might play with
the document.




"Andy_Trow" wrote:

I have created a table that I only want to enter data into one row. How can I
lock the other cells so they can't be edited, by myself or others. I may in
the future want to go and edit the locked cells at a later date.


Chip Pearson

Locking cells
 
Andy,

By default, all cells are locked so when you Protect the sheet (from the
Tools menu, Protection item), all cells will be uneditable. Select the cells
you want to be able to change, go to the Format menu, choose Cells, then the
Protection tab. There, uncheck the Locked option, enter a password if
desired, and then protect the sheet. Only those cells that you unlocked will
be editable. All other cells on the sheet will be locked.

Protecting a cell prevents it from being changed by either the user or VBA
code. If you want to allow VBA code to change any cell but still keep the
user from changing a cell, leave the cell Locked but protect the sheet via
VBA code using the UserInterfaceOnly option. In the ThisWorkbook code
module, use

Private Sub Workbook_Open()
ThisWorkbook.Worksheets("SheetName").Protect UserInterfaceOnly:=True ' ,
Password:="abc" ' password if desired
End Sub

Now, VBA code can change any cell but the user is still locked out. Note
that the UserInterfaceOnly option is available only via code (there is no
menu item or command button for it) and it does not get saved with the
workbook. You must set the property whenever the workbook is opened.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Andy_Trow" wrote in message
...
I have created a table that I only want to enter data into one row. How can
I
lock the other cells so they can't be edited, by myself or others. I may
in
the future want to go and edit the locked cells at a later date.




All times are GMT +1. The time now is 07:11 PM.

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