va quindi prima sprotetto il foglio .Unprotect
fatto il comando
e poi riprotetto il foglio .Protect
esempio:
Range("A1").Locked=False non bloccata
Range("A1").Locked=True bloccata
esempio:
ActiveSheet.Unprotect Password:=password non protetto
ActiveSheet.Protect Password:=password protetto
Sheets("test").Unprotect Password:=password non protetto
Sheets("test").Protect Password:=password protetto
esempio: proteggo un file excel con la password "ciao"
ActiveWorkbook.Password = "ciao"
esempio: se il file é di sola lettura esegue un certo comando, altrimenti un altro
If ActiveWorkbook.ReadOnly = True Then
...Else
...End If