ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   check if worksheet is protected using code (https://www.excelbanter.com/excel-programming/304030-check-if-worksheet-protected-using-code.html)

neowok[_68_]

check if worksheet is protected using code
 
Just wondering if theres a way i can do a simple "i
Worksheets("3.Data") is protected then"

also how would i assign a value to a cell using code? i.e. say A1
"blah" ? it didnt like cells(a1)="blah" which i assumed would be th
way.

thank

--
Message posted from http://www.ExcelForum.com


Frank Kabel

check if worksheet is protected using code
 
Hi
For your first question try
If Worksheets("3.Data").ProtectContents = True Then
MsgBox "The contents of shet '3-data 'are
protected."
End If


Second question
use something like
Range("A1").value="text"
or
cells(1,1).value="text"

-----Original Message-----
Just wondering if theres a way i can do a simple "if
Worksheets("3.Data") is protected then"

also how would i assign a value to a cell using code?

i.e. say A1 =
"blah" ? it didnt like cells(a1)="blah" which i assumed

would be the
way.

thanks


---
Message posted from http://www.ExcelForum.com/

.


neowok[_69_]

check if worksheet is protected using code
 
ok thanks, that work

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 10:36 AM.

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