When I use (some code here).copy destination:=(some code there)
. It will still prompt for protection issues on cells
. Basically it just won't let my code runs.
Asked
Active
Viewed 8,370 times
2

Tunaki
- 132,869
- 46
- 340
- 423

4 Leave Cover
- 1,248
- 12
- 40
- 83
-
Same issue here. Mine can't even work in workbook_open for no reason :( – 4 Leave Cover Apr 24 '13 at 06:41
2 Answers
13
The status UserInterfaceOnly:=TRUE
is unfortunately not stored in the file - therefore, if you reopen the file, it will be fully protected. Either use the Workbook_Open
event to reapply this protection status - or unprotect and then reprotect the worksheet in your VBA code directly.
See Ozgrid for further details!

Peter Albert
- 16,917
- 5
- 64
- 88
-
Very lamentable. This means Excel (still in 2021) cannot have VBA operating on protected cells. You can use no password or expose the password in the VBA, but these workarounds somewhat diminish the concept of protection. – DAG Aug 24 '21 at 19:03
-
@DAG Agree. You can password protect your VBA code. Again, not perfect - will deter most users. Anyone really trying to break into your Excel file will succeed with enough persistence regardless of your measures - excel is simply not the right tool if you’re looking for highest data security. – Peter Albert Aug 25 '21 at 09:14
0
I posted one approach to solving this here: https://stackoverflow.com/a/69730040/13307304
Like Peter Albert mentioned, the password itself should not be hardcoded

Dallin Romney
- 2,276
- 1
- 6
- 5