'EXCEL VBA UserInterfaceOnly:= True not working

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.



Solution 1:[1]

The status UserInterfaceOnly:=TRUEis 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!

Solution 2:[2]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peter Albert
Solution 2 Dallin Romney