Option explicit - VBA

Hello Readers,

Welcome to Coding by Learning !!! 😀 


what is use of Option Explicit

Option explicit is making declaration of variables mandatory. Developer cannot use a variable without declaring it. Also duplication variable names will be treated as error.

How to write Option Explicit

Way 1

Use the Option explicit text at the top of the module








Way 2

Go to VBA editor

Navigate  Tools -> Options. You can see following dialog box.


Check the dialog box Require Variable Declaration

Happy learning & Happy coding!!!

Comment and share this post to your friends and colleagues 😀

Comments

Popular posts from this blog

VBA Interview Questions - Part 2 - Variables and Data types

VBA Interview questions - screen updating

VBA Interview questions - Part 3 - Array concept