VBA Interview Questions
VBA Interview Questions
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
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)
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.
Variant
String
Single
Data
Double
Long
Currency etc.
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.
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.
On Error Goto 0
On Error Goto Err_Lbl
On Error Resume Next
Dim FSO
sFile = "C:\Test.xlsm"
'Set Object
If FSO.FileExists(sFile) Then
Else
End If
End Sub