excel vba interview questions

Visual Basic for Applications (VBA) is an Excel programming language that allows users to create automated data processing functions and generate data visualizations, such as charts or graphs. Having knowledge and experience using VBA can demonstrate your technological skill for employers and help you answer technical interview questions. Understanding what questions an interviewer might ask you about VBA may help you prepare for your next job interview. In this article, we discuss VBA interview questions, explain why an interviewer might ask them and provide sample answers to guide you.

VBA Interview Questions
  • What VBA stands for?
  • What Kind of Language VBA is?
  • What is an Object in VBA?
  • What is the Object Hierarchy in Excel?
  • How to Activate the Developer tab?
  • How to use the Visual Basic Editor?
  • Where you can Write a Macro (VBA Code)?
  • What are the Ways to Write a macro (VBA Code) in Excel?

Why would you use VBA to dial a phone number?

You can use VBA language within a spreadsheet to call phones. This can be a useful function for a variety of reasons, and interviewers may ask this question to know if youve ever used that function and how. Consider a scenario where youve wanted or needed to call phone numbers directly from a spreadsheet. Describe why this function may improve or optimize your workflow processes.

Example: “Some work tasks may require calling clients or consumers listed on a spreadsheet. Rather than manually dialing each phone number on a separate device, using a shell command through VBA saves time and allows me to call people directly. Using VBA to automatically dial a phone number saves time and minimizes dialing errors to speed up my work tasks.”

How do you classify data types in VBA?

An interviewer might ask you this to test your knowledge on industry terminology and VBA specific jargon. Knowing variable level vocabulary allows you to understand project directions and document or relay information accurately in reports or to superiors. There are two main classifications of data types in VBA and several in each category. List the data types that you know and provide a brief explanation of them.

Example: “The two categories of VBA data types are numeric and non-numeric. Users can manipulate numeric data types like bytes, integers, currencies and decimals to perform arithmetic functions. Non-numeric data types like dates, strings, objects or boolean cant perform those same functions. These data types inform computer operating systems about the data its storing and what functions its capable of.”

How would you define variable levels?

Variable levels feature different accesses and functions within VBA programming. Understanding these levels allows you to receive directions and work on the appropriate level to accomplish your task. There are three main levels in VBA that you can list and briefly explain. Interviewers may ask this question to understand how you view the importance of each level and how they may be necessary.

Example: “The three main variable levels which are the local, module and global levels. Each level provides users with different access, which ensures that code remains consistent. The local level features variables defined with DIM statements, while the module level has variables defined with a DIM statement on top of a module. The global level features variables defined by public statements on top of any module.”

Comments are used to document the program logic and the user information with which other programmers can work seamlessly on the same code in future. There are mainly two methods in VBA to represent comments.

In VBA, variable can be declared with the keyword “DIM” while constant is declared with keyword “Const.”

22) Mention how can you comment and uncomment blocks of code in the office VBA editor?

“Option Explicit” makes the declaration of variables mandatory. Line explicit function makes the compiler to determine all the variables that are not declared by the dim statement. This command diminishes the problem of type errors significantly. It is used in VBA because it deals with information rich application in which type errors are common. Before starting any, sub-procedures it can be used inside a module.

To find the last row in a column, the command used is End(xlUp) and to find last column in a row, the command used is End(xlToLeft).

Best VBA Interview Questions and Answers

Here is the list of most frequently asked VBA Interview Questions and Answers in technical interviews. These VBA questions and answers are suitable for both freshers and experienced professionals at any level. The VBA questions are for intermediate to somewhat advanced VBA professionals, but even if you are just a beginner or fresher you should be able to understand the VBA answers and explanations here we give.

In this post, you will get the most important and top VBA Interview Questions and Answers, which will be very helpful and useful to those who are preparing for jobs. Q1) Give the abbreviation for VBA?

VBA – Visual Basic Applications Q2) Provide some of the data types

Some of the data types are Object, Date, Integer, String, Byte, Long, Single, Variant, Boolean, Currency, Double, LongPtr, and LongLong. Q3) Explain Variant data type

A variant can get hold of any data type and this is the default data type. Q4) What are the levels where we can define a variable?

Global Level, Module Level, and Local Level are the levels where we can define a variable. Q5) Provide the different core module types existing in VBA

User Forms, Code Module, and Class Modules are the different core module types existing in VBA. Q6) Can you mention the difference between Functions and Procedures?

Functions return values, whereas Procedures never return a value. Q7) Mention the built-in class modules

Worksheet and Workbook modules are the built-in modules. Q8) Give the shortcut key to access the editor screen

Alt+F11 key is used to access the editor screen. Q9) Mention all the looping statements available in VBA

The most important looping statements available in VBA are For, Do, Until, Next, While, and Wend. Q10) List out the various UserForm Controls of VBA

Spin Button, Label, Combo Box, Scroll Bar, Button, Spin Button, Group Box, CheckBox, List Box, Option Button are some of the UserForm Controls of VBA. Q11) List out the various ActiveX Controls of VBA

Spin Button, CheckBox, Command Button, Option Button, Toggle Button, , Text Box, List Box, Label, Scroll Bar, and Combo Box are some of the ActiveX Controls of VBA. Q12) Provide the different error handling techniques

On Error Goto Err_Lbl, On Error Resume Next, and On Error Goto 0 are the three (3) error handling techniques in VBA. Q13) What are the two methods to check whether the file existing in a specific location or not?

Dir function and FileSystemObject are the two methods used to check whether the file existing in a specific location or not. Q14) How will you count a string?

CountA is the method used to count a string. Q15) Provide the shortcut for referencing the cell

The shortcut to reference the cell in VBA is ‘Fn+F4’. Q16) Explain Round function in VBA

For the given number of digits, Round function returns a rounded number. Q17) Explain sparklines in excel

In a cell, we can see a tiny chart that provides a visual representation of data. That is called sparklines in Excel Q18) What is the purpose of using Hyperlink in Excel?

Hyperlink is used to take the user to the given destination. Q19) Is it possible to call UDF in a macro?

Yes, it is possible to call UDF in macro. Q20) Describe ReDim

To size or resize a dynamic array which are declared already, ReDim is used. Q21) How will you add comments in Excel VBA?

To add comments in Excel VBA, you can use an apostrophe. Q22) Do you think Dictionary structure is available in VBA?

Yes, VBA has Dictionary Structure. Q23) Give the abbreviation of ADO

ADO stands for ActiveX Data Objects Q24) Give the abbreviation of ODBC

ODBC stands for Open Database Connectivity Q25) How will you reduce the reference counter explicitly?

Set a variable as ‘Nothing’ to reduce the reference counter explicitly. Q26) Give the abbreviation for COM in VBA

COM stands for Component Object Model, which are compiled executable programs. Q27) What are the two (2) methods to pass arguments in VBA?

ByRef and ByVal are the two (2) methods to pass arguments in VBA. Q28) Provide the difference between Functions and Subroutines in VBA.

Functions return values, whereas subroutines do not return any values. Function will not modify the actual arguments value, whereas subroutines can change the actual argument values. Q29) At runtime, which menu property cannot be set in VBA?

Name property cannot be set at runtime. Q30) What are the two (2) states of Boolean Data Type in VBA?

The two (2) states of Boolean Data type are True and False. Q31) Is it possible to increase the row count in a worksheet?

No, it is not possible to increase the row count in a worksheet. Q32) Provide the abbreviation of OLE

OLE stands for Object Linking and Embedding Q33) Through VB, in excel, how will you set custom paper size?

To set the custom paper size in Excel, use ‘Activesheet.PageSetup.PaperSize = xlPaperLetter’. Q34) Which macro language is used in the current days?

XLM was used in 1997 and before. VBA is the currently used language. Q35) Provide the various error types in VBA

The three (3) types of errors in VBA are Runtime, Syntax and Logic. Q36) In VB, is it possible to create cgi scripts?

Yes, we can create cgi scripts in VB. Q37) Provide the list of dialog box available in VB

User Defined, Predefined and Custom are the three (3) types of dialog box available in VB. Q38) List out the scopes of the class in VB

Friends, Public and Private are the class scopes in VB Q39) Provide the Validations types in VB

Form and Field are the two (2) types of Validation in VB Q40) Give the abbreviation for Mapi

Mapi stands for Messaging Application programming Interface Q41) List out the Style Properties available in List Box of VB

Extended, Multiple Select, Simple Single Select are the style properties available in List Box of VB. Q42) Provide the tool which is helpful in configuring the Protocols and Port Range

The tool ‘DCOMCONFIG.EXE’ is helpful in configuring the Protocols and Port Range. Q43) To run the VB, which Dll is required?

To run the VB, Vbrun300.dll is required. Q44) Provide the advantage of using Mts in VBA

Advantages of using Mts are given below:

  • Deployment
  • Database Pooling
  • Remote execution
  • Transactional Operations
  • Security
  • Q45) Provide the difference between MsgboxQ function and Msgbox Statement

    In VB, the user defines the MsgboxQ function, whereas VB has a built-in function called Msgbox. Q46) List out the cursor types in ADO

    Keyset, Forwardonly, Dynamic and Static are the four (4) cursor types in ADO. Q47) List out the Locking types in ADO

    lockbatchoptimistic, look pessimistic, Lockreadonly and lockoptimistic are the four (4) locking types in ADO. Q48) What are the controls that have a refresh method in VBA?

    Label, Listbox, button, Datagrid, and Combobox are the controls that have a refresh method. Q49) What are the controls that have a clear method in VBA?

    The textbox is the control that has a clear method. Q50) How will you compress an in control of VBA?

    Use ‘Stretch’ to compress an .


    Is Excel VBA a good skill?

    Is Learning VBA Worth It? Yes, learning VBA is worth it. With some companies still using VBA as an analytics tool for their data, you can be a top choice for roles requiring VBA proficiency. It also provides a stepping stone in understanding coding and programming holistically.

    Why VBA is used in Excel?

    You can use VBA in Excel to create and maintain complex trading, pricing, and risk-management models, forecast sales and earnings, and to generate financial ratios. With Visual Basic for Applications, you can create various portfolio-management and investment scenarios.

    Which one is core module types existing in VBA?

    User Forms, Code Module, and Class Modules are the different core module types existing in VBA.

    Is Excel VBA easy?

    Excel VBA is easy to learn, and it has easy to use User Interface in which you just have to drag and drop the interface controls. It also allows you to enhance Excel functionality by making it behave the way you want.

    Related Posts

    Leave a Reply

    Your email address will not be published.