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, Image, 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:
- Database Pooling
- Remote execution
- Transactional Operations
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 image in image control of VBA?
Use ‘Stretch’ to compress an image.