Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

By LOCKING the cells, and switching protection on will make whole file read-only .. But I want to make only few/selected cells as read-only .. that means, those cells cannot be edited anymore ..

Is there any facility as such pre-defined in MS-office .. Please let me know if you aware of this feature ..

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

A couple different solutions could be used...

  1. With the sheet not protected, use Format - Cells - Protection tab. Uncheck "Locked" for those cells to be changeable. Now protect the sheet with Tools - Protection - Protect sheet.

  2. If the first solution doesn't work, you could always use a macro to automatically kick people out of the cells you don't want them in. You could use a macro similar to the one below. Based on your selection, if it falls between the Range(A1:A4) it'll automatically kick you out of those cells and dump you into cell B1. I suppose you could use inidividual cells instead of a range.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  If Not Intersect(Selection, Range("A1:A4")) Is Nothing Then
    Range("B1").Select
  End If
End Sub
share|improve this answer
1  
ohk .. but where to copy paste this macro .. ? may sound simple to you but I don't know basics of it .. Please help :-| –  InfantPro'Aravind' Feb 16 '10 at 5:18
    
Click the Office button, choose Excel Options, check the "Show developer tab in Ribbon" checkbox and click OK. Click on the Developer tab at the top, click on Visual Basic. On the left hand side, double-click "This Workbook". Paste the code into the right hand side, save and close. Then, test the macro. –  Mark Feb 16 '10 at 12:49
    
Thank you so much .. Its working .. :-) I am too happy to learn this thing today .. :-) –  InfantPro'Aravind' Feb 17 '10 at 4:56
    
This won't work correctly if you ever insert rows or columns. –  guitarthrower Mar 12 '10 at 17:54
    
@guitarthrower, yup I am aware of it. –  InfantPro'Aravind' Mar 18 '10 at 11:54
add comment

You don't have to lock the whole sheet. You can just lock a few cells then protect the sheet, then the rest of the cells can be edited still.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.