Interview Questions

AJAX Interview Questions Android Interview Questions Angular 2 Interview Questions AngularJs Interview Questions Apache Presto Interview Questions Apache Tapestry Interview Questions Arduino Interview Questions ASP.NET MVC Interview Questions Aurelia Interview Questions AWS Interview Questions Blockchain Interview Questions Bootstrap Interview Questions C Interview Questions C Programming Coding Interview Questions C# Interview Questions Cakephp Interview Questions Cassandra Interview Questions CherryPy Interview Questions Clojure Interview Questions Cobol Interview Questions CodeIgniter interview Questions CoffeeScript Interview Questions Cordova Interview Questions CouchDB interview questions CSS Buttons Interview Questions CSS Interview Questions D Programming Language Interview Questions Dart Programming Language Interview Questions Data structure & Algorithm Interview Questions DB2 Interview Questions DBMS Interview Questions Django Interview Questions Docker Interview Questions DOJO Interview Questions Drupal Interview Questions Electron Interview Questions Elixir Interview Questions Erlang Interview Questions ES6 Interview Questions and Answers Euphoria Interview Questions ExpressJS Interview Questions Ext Js Interview Questions Firebase Interview Questions Flask Interview Questions Flex Interview Questions Fortran Interview Questions Foundation Interview Questions Framework7 Interview Questions FuelPHP Framework Interview Questions Go Programming Language Interview Questions Google Maps Interview Questions Groovy interview Questions GWT Interview Questions Hadoop Interview Questions Haskell Interview Questions Highcharts Interview Questions HTML Interview Questions HTTP Interview Questions Ionic Interview Questions iOS Interview Questions IoT Interview Questions Java BeanUtils Interview Questions Java Collections Interview Questions Java Interview Questions Java JDBC Interview Questions Java Multithreading Interview Questions Java OOPS Interview Questions Java Programming Coding Interview Questions Java Swing Interview Questions JavaFX Interview Questions JavaScript Interview Questions JCL (Job Control Language) Interview Questions Joomla Interview Questions jQuery Interview Questions js Interview Questions JSF Interview Questions JSP Interview Questions KnockoutJS Interview Questions Koa Interview Questions Laravel Interview Questions Less Interview Questions LISP Interview Questions Magento Interview Questions MariaDB Interview Questions Material Design Lite Interview Questions Materialize CSS Framework Interview Questions MathML Interview Questions MATLAB Interview Questions Meteor Interview Questions MongoDB interview Questions Moo Tools Interview Questions MySQL Interview Questions NodeJS Interview Questions OpenStack Interview Questions Oracle DBA Interview Questions Pascal Interview Questions Perl interview questions Phalcon Framework Interview Questions PhantomJS Interview Questions PhoneGap Interview Questions Php Interview Questions PL/SQL Interview Questions PostgreSQL Interview Questions PouchDB Interview Questions Prototype Interview Questions Pure CSS Interview Questions Python Interview Questions R programming Language Interview Questions React Native Interview Questions ReactJS Interview Questions RequireJs Interview Questions RESTful Web Services Interview Questions RPA Interview Questions Ruby on Rails Interview Questions SAS Interview Questions SASS Interview Questions Scala Interview Questions Sencha Touch Interview Questions SEO Interview Questions Servlet Interview Questions SQL Interview Questions SQL Server Interview Questions SQLite Interview Questions Struts Interview Questions SVG Interview Questions Swift Interview Questions Symfony PHP Framework Interview Questions T-SQL(Transact-SQL) Interview Questions TurboGears Framework Interview Questions TypeScript Interview Questions UiPath Interview Questions VB Script Interview Questions VBA Interview Questions WCF Interview Questions Web icon Interview Questions Web Service Interview Questions Web2py Framework Interview Questions WebGL Interview Questions Website Development Interview Questions WordPress Interview Questions Xamarin Interview Questions XHTML Interview Questions XML Interview Questions XSL Interview Questions Yii PHP Framework Interview Questions Zend Framework Interview Questions Network Architect Interview Questions

Top 15 VBA Interview Questions for 2022

1) What is VBA?

VBA stands for Visual Basic Application. It is an event-driven programming language. It is mainly used with Microsoft Office applications such as MS -Excel, MS-Word and MS-Access.

2) Who is the developer of VBA?

Microsoft is the developer of VBA.

3) What are the two ways to denote comments in VBA?

In VBA, there are two ways to denote comments:
  • Single Qutoe(‘) : Example â€˜Hello World
  • Start with REM keyword : Example REM Hello world

4) What is the use of MsgBox function?

MsgBox function is used to display a message box. Sytntax:
MsgBox(prompt[,buttons][,title][,helpfile,context])

5) How can we create user define functions in VBA?

We can create user define functions by using following syntax:
Function Functionname(parameter-list)  
   statement 1  
   statement 2  
   statement 3  
   .......  
   statement n  
End Function

6) What is the use of InputBox function in VBA?

In VBA, InputBox function is used to take input value.
InputBox(prompt[,title][,default][,xpos][,ypos][,helpfile,context])

7) What is the rule of naming a variable?

There are following rule of naming variable:
  • We should use a letter as the first character.
  • We should use a space , period(.) , exclamation mark (!) or the characters @, &,$,#.
  • Name can’t exceed 225 characters in length.
  • We can’t use Visual Basic the variable before using them

8) How to declare the variable in VBA?

In VBA, Dim keyword is used to declare the variable. Example:
Dim password As String

9) What are the types of operator in VBA?

There are following operators in VBA:
  • Arithmetic Operators
  • Comparison Operators
  • Logical (or Relational) Operators
  • Concatenation Operators

10) What are the loops in VBA?

There following loops in VBA:
  • for loop
  • for ..each loop
  • while..wend loop
  • do..while loops
  • do..until loops

11) What are the predefine String functions in VBA?

In VBA, predefine string functions are:
String functions Description
Lcase It returns the lower case of the specified string.
Ucase It returns the upper case of the specified string.
Ltrim It returns a string after removing the space on the left side of the specified string.
Len It returns the length of the given string.
Replace It returns a string after after replacing a string with another string.

12) How can we declare an Array?

We can declare an array by using given code:
'Method 1 : Using Dim  
Dim arr1()  'Without Size  
'Method 2 : Mentioning the Size  
Dim arr2(5)  'Declared with size of 5  
'Method 3 : using 'Array' Parameter  
Dim arr3  
arr3 = Array("apple","Orange","Grapes")

13) What is the use of ReDim statement in VBA?

In VBA, ReDim statement is used to declare dynamic-array variable and allocate or reallocate storage space. Syntax:
ReDim [Preserve] varname(subscripts) [, varname(subscripts)]

14) What are Array methods in VBA?

In VBA, There are given Array methods:
Array Method Description
LBound It returns an integer that corresponds to the smallest subscript of the given array.
UBound It returns an integer that corresponds to the largest subscript of the given arrays.
Join It returns a string that contains a specified number of values.
Erase It recovers the allocated memory for the array variables.
IsArray It returns a Boolean value that indicates whether or not the input variable is an array.

15) How many types of error in VBA?

In VBA, there are three types of error that are given below:
  • Syntax Errors
  • Runtime Errors
  • Logical Errors