ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I lock worksheets so only a couple ranges on each allow inp (https://www.excelbanter.com/excel-programming/350962-how-do-i-lock-worksheets-so-only-couple-ranges-each-allow-inp.html)

John

How do I lock worksheets so only a couple ranges on each allow inp
 
I have several worksheets w/ fields that display information and allow user
input in a couple of areas on each sheet. Each as macro buttons the user
pushes after his input to update another database worksheet. How do I lock
the entire db worksheet and all columns on the other sheets except the ranges
user input is allowed. The macros need to be able to update data in the
locked areas of any sheet.

avveerkar[_7_]

How do I lock worksheets so only a couple ranges on each allow inp
 

John Wrote:
I have several worksheets w/ fields that display information and allow
user
input in a couple of areas on each sheet. Each as macro buttons the
user
pushes after his input to update another database worksheet. How do I
lock
the entire db worksheet and all columns on the other sheets except the
ranges
user input is allowed. The macros need to be able to update data in
the
locked areas of any sheet.


You could unlock all the cells in the range manually while designing
your sheets( Format Cellprotectionlock untick) to which you want user
to have access ( or you can unlock the range through a procedure ) and
then protect all the sheets. Unprotect the sheets in your procedure
before you want to write data to protected area and protect it again
after you finish writing data.
Say I have a table of 10 rows and 2 cols (A1:B10). I want to give
access to users to col A but not B. After entering data in A, user
clicks a button and then the macro displays calculated results in B.
I would have initialising statements
Range(cells(1,1),cells(10,1).locked=false
Sheets("sheet 1").Protect Password="abcd"
This will allow user access to col A 10 rows, but nowhere on the
sheet.

My macro could be something like
Sheets("sheet1").Unprotect Password="abcd"
[B1]=..
[B2]=..
etc
Sheets("sheet1").Protect Password="abcd"
What I am doing is unprotecting the sheet just before I want to update
col B and then protecting it again.


--
avveerkar
------------------------------------------------------------------------
avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338
View this thread: http://www.excelforum.com/showthread...hreadid=503151



All times are GMT +1. The time now is 05:43 AM.

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