0% found this document useful (0 votes)
318 views5 pages

VBA Interview Questions

This document discusses interview questions and answers related to VBA (Visual Basic for Applications). Some key points covered include: - VBA is a programming language used mainly in Microsoft Office applications like Excel, Word, and Access. - The main difference between subroutines and functions is that subroutines cannot return values while functions return values. - Common techniques for debugging VBA code include using breakpoints, step-by-step execution, and the immediate window. - Variables can have different scopes like module-level, local-level, or global-level depending on how they are defined. - Option Explicit enforces variable declaration in VBA which helps avoid errors.

Uploaded by

Nilu Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
318 views5 pages

VBA Interview Questions

This document discusses interview questions and answers related to VBA (Visual Basic for Applications). Some key points covered include: - VBA is a programming language used mainly in Microsoft Office applications like Excel, Word, and Access. - The main difference between subroutines and functions is that subroutines cannot return values while functions return values. - Common techniques for debugging VBA code include using breakpoints, step-by-step execution, and the immediate window. - Variables can have different scopes like module-level, local-level, or global-level depending on how they are defined. - Option Explicit enforces variable declaration in VBA which helps avoid errors.

Uploaded by

Nilu Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 5

VBA Interview Questions & Answers

1. What do you mean by VBA?


VBA is known as Visual Basic for Application; it is an experience-driven programming language
urbanized by Microsoft. It is largely used with Microsoft office application like MS Access, MS
Word and MS Excel.

2. Tell me the way to decrease the reference counter explicitly?


To reduce the reference counter clearly, you need to locate a variable to “Nothing”.

3. State the difference between Subroutines and Functions in VBA?


The difference between subroutines and Functions is:

 Subroutines could modify the values of the definite arguments while a function could not transform
the value of actual arguments.
 Subroutines never revisit a value, but functions do return values

4. How to debug a VBA code?


To debug, VBA code, follow the steps:

 Using Breakpoints
 Step by step execution
 Print & Immediate window and watch the window

5. Define the code to find a last used Row in a column or last used column of a row?
To find the previous row in a column, the column used is End (xlUp) and to find the last column
in a row, the command used is End (xlTOLeft)

6. How can you pass arguments to VBA functions?


When arguments are approved to VBA functions, they can be passed in two ways:

 ByRef: When the argument is accepted by reference than the real address of the argument is passed
to the process. Any changes that are made to the quarrel inside the process will be recalled when
the method is exited.
 By Val: When the argument is approved by Value, then it means that only Value is accepted to the
procedure, and any changes that are made to the quarrel inside the process will be lost when the
method is exited.

7. Name some data types?


Some of the data types are:

 Variant
 String
 Single
 Data
 Double
 Long
 Currency etc.

8. Define the shortcut for sum?


ALT and +

9. Define the scope of variables?


It can be defined in different levels:

 Module-level: It is defined with a DIM statement on top of a module, can be accessed in the entire
module
 Local-level: Variables which are distinct from the DIM statement in a process

 Global level: It is defined as a public statement at the top of any module, can be accessed in the
entire project.

10. Explain Option Explicit?


Option Explicit power the variables to be affirmed before using the variable. This is one of the
most excellent practices for VBA developers to pass up type errors and construct error-free
applications.

11. Tell me the difference between procedures and functions?


Procedures will not return a value, whereas functions will return values.

12. What do you mean by Built-in class modules?


A worksheet, Workbook modules are class modules.

13. Define the way to stop recording a macro?


The following steps to stop recording macro in the workbook are:

 Go to developer tab from the main ribbon of the Excel window


 Click on “stop recording” command button to stop from the recording macro.

14. Define conditional formatting?


It allows colouring the cells, based upon conditions.

15. Name the different user form controls and Active X controls?
User Form Controls:

CheckBox, Option Button, Scroll Bar, Button and List Box etc.

Active X Controls:

Text Box, Command Button, Scroll Bar, Option Button, Label and Image etc.

16. How you can stop VBA script when it goes into the infinite loop?
By vital Cntrl+ Pause Break, key one can discontinue VBA script when it goes into an infinite
loop.

17. Explain what are COM objects in VBA?


COM objects are frequently .dll files and are compiled executable programs.

18. Name the different types of error handling techniques?


The different types of error handling techniques are:

 On Error Goto 0
 On Error Goto Err_Lbl
 On Error Resume Next

19. How you can delete a file in a specified location?


Sub sbDelete_File()

Dim FSO

Dim sFile As String

sFile = "C:\Test.xlsm"

'Set Object

Set FSO = CreateObject("Scripting.FileSystemObject")

'Check File Exists or Not

If FSO.FileExists(sFile) Then

FSO.DeleteFile sFile, True

MsgBox "Deleted The File Successfully", vbInformation, "Done!"

Else

MsgBox "Specified File Not Found", vbInformation, "Not Found!"

End If

End Sub

20. Tell me the way to count a string in excel?


Count A

21. What is the shortcut to reference the cell?


Fn +F4

22. Define lookup function in Excel?


It precedes a value from a range.

23. Define the shortcut of Paste Special Values?


AL T E S V for values.

24. Define the use of excel?


It is an application to use for visualization, calculations and analytics

25. Define match functions?


It is lookup function in excel which search for a value in the array and returns relative position.

You might also like