T
thebison
Hi
I have Excel 2003 SP3 and I have what I thought was correct code when
investigating other peoples issues. However at the end of the loop, the whole
sheet is protected, not just the cells. How do I start from an unprotected
sheet, lock some cells only, and keep the remainder of the sheet protected?
(I have tried with unprotect and protect out of the loop
Thanks
'rstData is a dataset of info which has a column that has an Excel Cell
name such as C10, B23, F16
Set rstData = oDatabase.RecordsetData
With rstData
.MoveFirst
Do While Not .EOF
ActiveWorkbook.ActiveSheet.Unprotect Password:="MyPwd"
ActiveWorkbook.ActiveSheet.Range(rstData("ExcelCellPos")).Locked
= True
ActiveWorkbook.ActiveSheet.Protect Password:="MyPwd"
.MoveNext
Loop
End With
I have Excel 2003 SP3 and I have what I thought was correct code when
investigating other peoples issues. However at the end of the loop, the whole
sheet is protected, not just the cells. How do I start from an unprotected
sheet, lock some cells only, and keep the remainder of the sheet protected?
(I have tried with unprotect and protect out of the loop
Thanks
'rstData is a dataset of info which has a column that has an Excel Cell
name such as C10, B23, F16
Set rstData = oDatabase.RecordsetData
With rstData
.MoveFirst
Do While Not .EOF
ActiveWorkbook.ActiveSheet.Unprotect Password:="MyPwd"
ActiveWorkbook.ActiveSheet.Range(rstData("ExcelCellPos")).Locked
= True
ActiveWorkbook.ActiveSheet.Protect Password:="MyPwd"
.MoveNext
Loop
End With