ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   locked cells and code (https://www.excelbanter.com/excel-programming/395432-locked-cells-code.html)

Jock

locked cells and code
 
If cells are 'locked' I have found that data which is supposed to be
inserted by code isn't.
Is there a way around this?
--
Traa Dy Liooar

Jock

Trevor via OfficeKB.com

locked cells and code
 
The code needs to unprotect the worksheet before updating the cells and, if
required, protect the worksheet after updating the cells.

Jock wrote:
If cells are 'locked' I have found that data which is supposed to be
inserted by code isn't.
Is there a way around this?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200708/1


Mike H

locked cells and code
 
Jock,

Unprotect make you changes and then reprotect at runtime

Sub standard()
ActiveSheet.Unprotect Password:="Mypass"
'Make your changes
ActiveSheet.protect Password:="Mypass"
End Sub

Mike

"Jock" wrote:

If cells are 'locked' I have found that data which is supposed to be
inserted by code isn't.
Is there a way around this?
--
Traa Dy Liooar

Jock


Jock

locked cells and code
 
Thanks to Trevor & Mike
--
Traa Dy Liooar

Jock


"Trevor via OfficeKB.com" wrote:

The code needs to unprotect the worksheet before updating the cells and, if
required, protect the worksheet after updating the cells.

Jock wrote:
If cells are 'locked' I have found that data which is supposed to be
inserted by code isn't.
Is there a way around this?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200708/1




All times are GMT +1. The time now is 02:45 PM.

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