0

I have written a VBA macro to do some stuff in Excel, and I want to know if the following is possible.

How do I protect a Macro so that no matter who uses the spreadsheet, they cannot edit the code? The protection needs to be strong enough that even if they press ALT + F11 and pull up the macro, the Edit button options need to be greyed out, even if the macro has been selected.

Also is it possible to stop a user from even seeing the code?

aynber
  • 22,380
  • 8
  • 50
  • 63
user154924
  • 43
  • 5

1 Answers1

1

I think the easiest way is just to protect the workbook code. VBA Project properties -> Protection -> Lock project for viewing. You will need to specify a password.

It's not world-class protection, but it will stop the average user editing the code.

Joel Goodwin
  • 5,026
  • 27
  • 30