Basic VBA Interview Questions and Answers

Basic VBA Interview Questions will be asked generally for Freshers, or 1-2 year experienced people. Here are the most commonly asked Basic VBA Questions and Answers covered from Basics of VBA Programming.

  • VBA stands for Visual Basic for Applications.
  • VBA is Programming language available in MS Office Tools.
Data types helps to declare Variables with specific data, this helps to VBA to know the type of the data and assign the memory based on the DataType of the Variable.
  1. Boolean
  2. Byte
  3. Currency
  4. Date
  5. Double
  6. Integer
  7. Long
  8. LongLong
  9. LongPtr
  10. Object
  11. Single
  12. String
  13. Variant
Variant data type is default data type and it can hold any type of data. This will allocate maximum memory to hold the Varian Type. We use Variant data-type when we dot know the type of the data or to accept the multiple data types in a single variable.
We can define variable in different levels:

  • Local Level: Variables which are defined with DIM statement in a procedure or functions
  • Module Level: Which are defined with DIM statement on top of a module, can be accessed in entire module
  • Global Level: Which are defined Public statement at top of any module, can be accessed in entire project.
  • Arrays are type of variables allows to store multiple data values in one variable. It can contain multiple Dimensions like 2-dimensions, 3-dimensions,etc.
    We can redefine the size of the array using REDIM statement. We use PARSE statement will to keep the previously stored data in the data.
    Group of one particular objects are called Collections. This helps to loop through each object in the collection. Example: Sheets collection helps to loop through each each in the Workbook.
    Constants are fixed to memory holders to assign any fixed value.
    • Objects: An Object is nothing but a class. And object can have Child Objects, Methods, Properties and Events.
    • Methods: Methods are procures or actions available for a particular object. Example, Close, Open, Save methods of Workbook Object.
    • Properties: Properties are characteristics of an Object. Example: Path, Name of Workbook Object.
    • Events: Events are triggers available for an Objects. Example, Workbook Open Event, Workbook Before Close Event.
    • Execution: Place the Cursor in a procedure and Press F5 to Execute
    • Step by Step Execution: Place the Cursor in a procedure and Press F8 to Execute the Program Step by Step
    • Toggle Breakpoints: Place the Cursor at the required statement and Press F9 to toggle the Breakpoint Printing in Immediate Window: Use Debug.Print to print in the Immediate Window
    • Executing in Immediate Window: Write your expression in the immediate window preceded by ? (question mark) and enter to execute the expression.
    • Press Esc Key to goto Debug Mode
    • Press Ctrl+ Pause Break Key to Skip from the Infinite execution.

    Here is the link for more VBA Interview Questions and Answers. These are explained for examples.
    100+ VBA Interview Questions