ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Locking all cells (https://www.excelbanter.com/excel-programming/347258-locking-all-cells.html)

Patrick Simonds

Locking all cells
 
I have a workbook which to open you have to select Edit or Review from a
DialogBox. If you select Edit you have to get past a password and then you
can make certain editing changes. If you select Review you can open the
Workbook (and print) but can not make any changes. Well at least that's my
plan. Is there any way to lock down a worksheet so that someone can not
even select a cell? When someone selects Edit they get a worksheet which has
some locked cells but can edit others cells, so I can not just format all
cells to lock or they would loose their ability to edit.



K Dales[_2_]

Locking all cells
 
If you want to prevent them from even selecting the cells you can set the
scrollarea:
Worksheets("Sheet1").ScrollArea = "A1"
This will effectively "lock" the selection to A1. You would need to reset it
in order for the "Edit" users to not be stuck, though. Best way to do it
would to be in the routine that displays the dialog box (is this in another
workbook, or is it in Workbook_Open?). Basic idea is as follows:

' Code for dialog box and opening worksheet would be here
If {"Edit" and user entered correct password} Then
' replace {} above with appropriate code
Worksheets("Sheet1").ScrollArea = ""
...
Else
Worksheets("Sheet1").ScrollArea = "A1"
...
End If
--
- K Dales


"Patrick Simonds" wrote:

I have a workbook which to open you have to select Edit or Review from a
DialogBox. If you select Edit you have to get past a password and then you
can make certain editing changes. If you select Review you can open the
Workbook (and print) but can not make any changes. Well at least that's my
plan. Is there any way to lock down a worksheet so that someone can not
even select a cell? When someone selects Edit they get a worksheet which has
some locked cells but can edit others cells, so I can not just format all
cells to lock or they would loose their ability to edit.





All times are GMT +1. The time now is 12:29 PM.

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