ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatic unlocking and locking worksheet on opening excel (https://www.excelbanter.com/excel-programming/300201-automatic-unlocking-locking-worksheet-opening-excel.html)

Hari[_3_]

Automatic unlocking and locking worksheet on opening excel
 
Hi,

I checked the newsgroup but couldnt find my message posted hence, Im
reposting .( Strangely my sent items shows that this message has been
sent ).

Please tell me how to set up the same.

Regards,
Hari
India

"Hari" wrote in message news:...
Hi,

I have got a sheet Report data in which except one cell ( cell A3 ) the

whle
sheet is protected. I want user to enter info in this cell before exiting
the workbook otherwise the workbook will not save. Similarly when I open

the
worksheet I want to copy excel to automatically copy the A3 cell to J3

cell
and make the A3 cell blank.

I wrote the following code. When I open the worksheet excel asks me for

the
password. Cant excel automatically unlock the sheet and then lock the

sheet.
Do I have to give the password here. if so, please tell me what would be

the
syntax of the same.

Regards,
Hari
India


Private Sub Workbook_Open()

Sheets("Report Data").Unprotect

Sheets("Report Data").Cells(12, 10) = Sheets("Report Data").Cells(3, 1)
Sheets("Report Data").Protect

Sheets("Report Data").Cells(3, 1) = ""

End Sub






Tom Ogilvy

Automatic unlocking and locking worksheet on opening excel
 
Sheets("Report Data").Unprotect Password:="Hotdog"



Sheets("Report Data").protect Password:="Hotdog"

--
Regards,
Tom Ogilvy

"Hari" wrote in message
...
Hi,

I checked the newsgroup but couldnt find my message posted hence, Im
reposting .( Strangely my sent items shows that this message has been
sent ).

Please tell me how to set up the same.

Regards,
Hari
India

"Hari" wrote in message news:...
Hi,

I have got a sheet Report data in which except one cell ( cell A3 ) the

whle
sheet is protected. I want user to enter info in this cell before

exiting
the workbook otherwise the workbook will not save. Similarly when I open

the
worksheet I want to copy excel to automatically copy the A3 cell to J3

cell
and make the A3 cell blank.

I wrote the following code. When I open the worksheet excel asks me for

the
password. Cant excel automatically unlock the sheet and then lock the

sheet.
Do I have to give the password here. if so, please tell me what would be

the
syntax of the same.

Regards,
Hari
India


Private Sub Workbook_Open()

Sheets("Report Data").Unprotect

Sheets("Report Data").Cells(12, 10) = Sheets("Report Data").Cells(3, 1)
Sheets("Report Data").Protect

Sheets("Report Data").Cells(3, 1) = ""

End Sub









All times are GMT +1. The time now is 10:41 PM.

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