Locking cells

G

Guest

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.
 
G

Guest

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.
 
C

Chip Pearson

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top