Here in this article we will start with the VBA ( Visual Basic for Applications ) editor , we will learn how to enable the developer Tab to start with VBA coding . How to access with VBA editor.
How to enable Developer Tab in MS-Excel ?
To start with the VBA , we need to enable the developer tab n MS-Excel which is by-default is disabled.
Steps to Enable the developer Tab in MS-Excel
1) Go to the “File” and click on “Options“.
2) Click ‘Customize the Ribbon’ tab and check ‘Developer‘. Click ‘OK’.
See the Below Developer Tab is enabled Now
Click on Visual Basic and Editor Will Open
Right Click on “VBA projects” and Go to “Insert” and click on “Module“.
A new Module is Created Below and a plain text screen is presenting in which we write our code.
What are Modules in VBA ?
Modules is the plain text area like notepad where we write our code to automate the manual task. We write a series of VBA statements in modules. In Modules we write the series of VBA statements and execute it.
In modules we write the coded in “procedures” only.
What are Procedures in VBA ?
In procedures we write the series of codes or VBA statements. Procedures are of two types in VBA namely SUB and Functions.
What are SUB in VBA ?
1) Sub is one of the type of procedure in VBA .
2) It always starts with “Sub” and ends with “End Sub”.
3) Sub do not returns any value.
4) Sub can be called without keyword “Call“. They can be called directly.
Sub in VBA code Below
''''''''' ' This is Sub Sub Display_MessageBox() ' Declaration of Sub MsgBox "Hi My name is Padhle" End Sub ' End of Sub
we will discuss about Sub in later section.
What are Functions in VBA ?
1) Function is one of the type of procedure in which we write the VBA statements.
2) Functions may or may not return the value.
3) It always starts with “Function” and ends with “End Function“.
4) Functions are written to reuse them.
Function in VBA code Below
' This is Function Function Display_MessageBox() ' Declaration of Sub MsgBox "Hi My name is Padhle" End Function ' End of Sub
This article is all about the how to access the VBA editor and How to define function and Sub in VBA. we will learn about Sub and VBA in later tutorials.