Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
405
Locking cell in worksheet
posted
I've created the excel worksheet and saved it. What I need to do it lock certain cells in the worksheet. my code to lock the cells is: For col As Integer = 0 To mPrimaryKeyColumn.Length - 1 For Each row As WorksheetRow In theWorkSheet.Rows row.Cells(col).CellFormat.Locked = ExcelDefaultableBoolean.True Next Next theWorkSheet.Protected = True The problem is, is that "theWorkSheet.Protected = True" locks the whole worksheet. I have tried to set every single cell to "row.Cells(col).CellFormat.Locked = ExcelDefaultableBoolean.False" before protecting the worksheet, but with no success. In excel (2007), in the "Protect Sheet" options, there is a whole list of permission that you can allow users to do to locked worksheets. I need to allow the users to edit cells that are not locked. How? Please help.
Parents
No Data
Reply
  • 44743
    posted

    All cells are Locked by default. You must set Locked to False and then set Protected to True on the worksheet. Then you will be able to edit only the cells which are not locked. Also, if you know all cells in a row or column should be unlocked, you can set the Locked property on the cell format of the row or column. If this is not working correctly, it may be a bug and you can submit the issue to the support group: http://ko.infragistics.com/gethelp.

Children