Thursday, June 25, 2020

Add Option Explicit Statement Automatically in VBA Code

You can understand the use of Option Explicit statement in the VBA code by clicking here. Now, here you'll see that how you can instruct the Excel VBA to automatically add Option Explicit statement in your VBA code. To do so please follow the following steps: 




  1. Go to the Visual Basic Editor. then,
  2. Click on the Tools menu and then,
  3. Click on the Options, It will open the Options Wizard as shown in the below screenshot



  4. Check Require Variable Declaration option available under Editor Tab of the Options Wizard window, then
  5. Click on the OK button.
There you go! Now, whenever you start the Visual Basic Editor in the excel and insert a new Module. You will see that Option Explicit statement is already written in the code window.




No comments:

Post a Comment