VBA For Excel Interview Questions & Answers

  1. Question 1. Explain About Visual Basic And Its Importance?

    Answer :

    Microsoft holds license for Visual basic applications and it has been developing that language. Visual basic applications have an embedded programming environment which assists programmers in developing custom solutions by using almost all features of visual basic. Applications which are currently hosting visual basic can fully utilize the power of Visual basic applications because they have an added functionality and ease of visual basic applications.

  2. Question 2. State The Difference Between Visual Basic, Vb Script And Visual Basic Applications?

    Answer :

    • Visual basic is useful if you are planning to develop your programs from scratch. This language helps you in developing Active x controls, exe files, etc.
    • Visual script is a powerful tool, through which you can create small scale applications on web pages, automation applications, etc. Integrated development environment is not present for VB script.
    • Visual basic applications are very useful in automating your existing application. VB application is useful for developing already existing applications.


  3. Microsoft Excel Interview Questions

  4. Question 3. Name The Platforms Through Which Visual Basic Applications Are Available?

    Answer :

    Most of the visual basic applications are available on 32 bit Intel platforms. These applications also run on many of the windows software systems such as server 2003, XP, Vista, etc.

  5. Question 4. Define And Explain About Com Add-ins?

    Answer :

    COM add-ins are software program’s which are integrated into an application and they add already built in features to an existing application. They have common architecture across multiple applications which help in deploying applications much faster across varied applications. Microsoft 2007 supports various COM add-INS.

  6. VBA For Excel Tutorial

  7. Question 5. How Best Can A Programmer Utilize The Benefits Of Vba With Office (07)?

    Answer :

    Microsoft office 2007 supports Visual basic and has support with many various features. With MS office 2007 you can use desktop applications for creating tailored business solutions. These desktop applications can be used directly as construction sites.

  8. Microsoft Word Interview Questions

  9. Question 6. Explain About The Security Vulnerabilities For Vba?

    Answer :

    Microsoft Visual basic has its host of problems one such being macros, Macros can be created which can create a havoc for a programmer with good intentions. Also the security issue rests in the hands of the user and not the programmer as such. A user can manipulate the VBA document.

  10. Question 7. Explain About Line Option Explicit?

    Answer :

    Line explicit function makes the compiler to identify all the variables which are not specified by the dim statement. This command significantly reduces the problem of type errors. This is used extensively because VBA deals with information rich applications in which type errors are common.

  11. Microsoft Excel Tutorial
    Microsoft Powerpoint Interview Questions

  12. Question 8. Give Technical Reasons Which Made Microsoft Withdraw Its Support For Vba In Mac?

    Answer :

    The reasons which made Microsoft drop its support to VBA are as follows, Microsoft visual basic relies heavily on machine code which was written for Power PC architecture. Also it would take another two years for developing VBA support for its architecture. It also states that Microsoft will incorporate VBA in the next script of office release for Mac.

  13. Question 9. How Can You Format Expressions By Using Vba?

    Answer :

    Format functions can be used to format many of the expressions such as currency, time, date, percentages and numbers. These functions are much simpler to use in VBA. User defined date, numeric and string formats are present in many of the applications.

  14. Microsoft Entity Framework Interview Questions

  15. Question 10. How Do You Use The Getsetting And Savesetting Functions To Read And Write Registry Settings?

    Answer :

    A computer registry can be used to store configuration settings and application initialization. We can use Getsetting function to read registry settings and save settings function to write registry settings. Application name, section, key, setting, and default are to be specified for registry modifying. It is advisable to know about your computer settings before modifying registry settings.

  16. Microsoft Word Tutorial

  17. Question 11. What Forms Should Be Used For Complex User Input?

    Answer :

    Userforms should be used for complex user input. When an application input has non text as an input it is advisable to use Userforms rather than the input boxes. When you are using Userforms a user can give input any number of times which is not the case when you use input boxes. This can be accessible from the insert menu in your VBA editor after which you can insert your code.

  18. Microsoft Azure Interview Questions

  19. Question 12. Explain About Function Pointers?

    Answer :

    Visual basic applications have very rich and flexible applications but there is one limitation when using pointer function. Windows API has limited support for function pointers because it has the ability to use but not the functional support to call back the function. But later versions have support for modules. Function pointers have inbuilt support (DLL’s) for call but not for call back.

  20. Microsoft Excel Interview Questions

  21. Question 13. State Some General Uses For Visual Basic Applications In General Context?

    Answer :

    Visual basic can be used within almost all Microsoft products such as Map point, Visio, Auto cad, Word perfect, ArcGIS, word, excel, etc. With VBA you can control many functions such as host application, menus, toolbars, user interface, import and export of files, data transfer and extraction from multiple interfaces.

  22. Microsoft Powerpoint Tutorial

  23. Question 14. Explain About Insert Module And Goal Seek Functions Present In Vba?

    Answer :

    The chief use of VBA is to make use of its special function which helps in repeated actions. Goal seek function helps to reduce manual entry of the code each and every time. This solves the problem of repeated function entry by automating functions and actions. Sub routines are inserted into the using the VBA editor and command insert module.

  24. Question 15. How Can We Use Data Validation Function In Vba?

    Answer :

    Data validation is an important concept in VBA. Application procedure and a custom dialog box can be used to correct input errors. You can assign an application procedure to the frame of a dialog box. Error message or custom dialog box can be highlighted with the first field with errors.

  25. Microsoft Project Interview Questions

  26. Question 16. How Can We Dial A Phone Number?

    Answer :

    Shell command present in VBA can be used to start the dialer present in windows operating system. Phone number can be used to connect to your modem. With the use of shell and sendkeys you can dial to your user. Shell starts windows application and sendkeys inform the window to dial according to the keystrokes of the application. A macro can be used to start the cardfile program which activates the auto dialer feature.

  27. Microsoft Entity Framework Tutorial

  28. Question 17. What Is The Difference Between Byval And Byref And Which Is Default ?

    Answer :

    • ByRef: If you pass an argument by reference when calling a procedure the procedure access to the actual variable in memory. As a result the variable’s value can be changed by the procedure.
    • ByVal: If you pass an argument by value when calling a procedure the variable’s value can be changed with in the procedure only outside the actual value of the variable is retained.
    • ByRef is default: Passing by reference is the default in VBA. If you do not explicitly specify to pass an argument by value VBA will pass it by reference.
  29. Excel Data Analysis Interview Questions

  30. Question 18. What Is The Meaning Of Option Explicit And Option Base?

    Answer :

    Option Explicit makes the declaration of Variables Mandatory while Option Base used at module level to declare the default lower bound for array subscripts. For eg. Option Base 1 will make the array lower bound as 1 instead of 0.

  31. Microsoft Word Interview Questions

  32. Question 19. What Are Various Data Type And Their Size?

    Answer :

    •  The Boolean data type has only two states, True and False. These types of variables are stored as 16-bit (2 Byte) numbers, and are usually used for flags.
    •  The Byte data type is an 8-bit variable which can store value from 0 to 255.
    • The Double data type is a 64-bit floating point number used when high accuracy is needed.
    •  The Integer data type is a 16-bit number which can range from -32768 to 32767. Integers should be used when you are working with values that can not contain fractional numbers. In case, you’re working over 32767 rows use Long as data type.
    • The Long data type is a 32-bit number which can range from -2,147,483,648 to 2,147,483,647.
    •  The Single data type is a 32-bit number ranging from -3.402823e38 to -1.401298e-45 for negative values and from 1.401298e-45 to 3.402823e38 for positive values. When you need fractional numbers within this range, this is the data type to use.
    • The String data type is usually used as a variable-length type of variable. A variable-length string can contain up to approximately 2 billion characters. Each character has a value ranging from 0 to 255 based on the ASCII character set.
  33. Microsoft Azure Tutorial

  34. Question 20. Difference Between Activeworkbook And Thisworkbook.

    Answer :

    ThisWorkbook refers to the workbook where code is being written while ActiveWorkbook refers to the workbook which is in active state with active window. In case of only one workbook open, ActiveWorkbook is same as ThisWorkbook.

  35. Excel pivot tables Interview Questions

  36. Question 21. Code To Find A Last Used Row In A Column Or Last Used Column Of A Row.

    Answer :

    Last Row in a column can be find using End(xlUp) and Last Column in a row can be find using End(xlToLeft). For e.g. Range(“A1048576”).End(xlUp).Row gives last used row of Column A.

  37. Question 22. Difference Between Activex And Form Controls.

    Answer :

    • Forms controls can be used on worksheets and chart sheets. Forms controls can also be placed within embedded charts in Classic Excel (though not in Excel 2007). ActiveX controls can only be used on worksheets. ActiveX controls do not work in MacExcel.
    • The Forms controls aren’t very complicated, and they have been part of Excel for longer (they were used in Excel 5/95’s dialog sheets) than the Controls Toolbox (Excel 97), so it stands to reason that they’d be more seamlessly integrated. Being newer, the ActiveX controls have richer formatting possibilities. Both can link to cells and ranges in the worksheet.
  38. Microsoft Project Tutorial

  39. Question 23. What Is The Difference B/w Functions And Subroutines?

    Answer :

    • Subroutines never return a value but functions does return values.
    • A function could not change the values of actual arguments whereas a subroutine could change them.
  40. Excel Power View Interview Questions

  41. Question 24. How To Debug A Vba Code?

    Answer :

    Using Breakpoints(F9), Step-by-step execution (F8), Debug.Print & Immediate Window and Watch window.

  42. Microsoft Powerpoint Interview Questions

  43. Question 25. Draw Basic Excel Object Model?

    Answer :

    Application –> Workbooks –> Worksheets –> Range / Chart.

  44. Advanced Excel Charts Tutorial

  45. Question 26. Can You Lock Cells Such That Only Specific Users Can Modify Them?

    Answer :

    There is a option “Allow users to edit ranges” can be used for this purpose.

  46. Microsoft Interview Questions

  47. Question 27. How Can You Add A Drop-down List To A Cell So The User Can Choose A Value From The List?

    Answer :

    Using ‘Data Validation’.

  48. Microsoft Entity Framework Interview Questions

  49. Question 28. How Can You Increase The Number Of Rows In A Worksheet?

    Answer :

    No one can’t. They’re fixed as 65536(2^16) in Excel 2003 or before and 1048576(2^20) in Excel 2007 & Excel 2010.

  50. Advanced Excel Functions Tutorial

  51. Question 29. How Can You Increase The Number Of Columns In A Worksheet?

    Answer :

    No one can’t. They’re fixed as 256(2^8) in Excel 2003 or before and 16384(2^14) in Excel 2007 & Excel 2010.

  52. Question 30. How Will You Distribute A Workbook Such That It Can’t Be Copied Using Macro Or Anything?

    Answer :

    We can create a workbook which cannot be modified but cannot create a workbook which can’t be copied.(It depends on system security, it has nothing to do with Excel or VBA)

  53. Question 31. What Types Of Workbook Protection Are Available?

    Answer :

    Excel provides three ways to protect a workbook:

    • Require a password to open the workbook.
    • Prevent users from adding sheets, deleting sheets, hiding sheets, and unhiding sheets.
    • Prevent users from changing the size or position of windows.
  54. Excel Dashboards Tutorial

  55. Question 32. The Font Dialog Box Allows You To Select Different Fonts, Their Style, Their Size, And Some Other Special Effects. How Do You Bring Up This Font Dialog Box?

    Answer :

    Use Application.Dialogs(xlDialogFont).Show or Application.Dialogs(xlDialogFormatFont).Show to load font dialog box from Excel VBA.

  56. Question 33. What Is Ado, Oledb & Odbc?

    Answer :

    ADO : ActiveX Data Objects is universal data access framework that encompasses the functionality of DAO.
    ODBC : Open Database Connectivity(ODBC) is a windows technology that lets a database client application connect to a external database.
    OLEDB : Low level programming interface designed to access a wide variety of data access Object Linking and Embedding (OLE).

  57. Microsoft Azure Interview Questions

  58. Question 34. How To Set The Custom Paper Size In Excel Object Through Vb?

    Answer :

    Activesheet.PageSetup.PaperSize = xlPaperLetter (Similarly xlPaperA4 or xlPaperLegal etc.).

  59. Question 35. What Is The Method For Returning More Than One Values From A Function In Vb?

    Answer :

    Any of the three methods can be used:

    • Create a class with the properties you require to return and then return the object of the class from the function.
    • Using ByRef for the values.
    • Return an array of the values.
  60. Question 36. Does Vba Supports Oop Principles?

    Answer :

    Yes because VBA is VB6.0 based which is an Object Based Programming Language and is also known as ‘Event Driven Programming’ and it supports Polymorphism, Encapsulation and partially Inheritance.

  61. Microsoft Project Interview Questions

  62. Question 37. To Set The Command Button For Esc, Which Property Needs To Be Changed?

    Answer :

    Set Cancel property of Button to True on the Form.

  63. Question 38. What Is Type Library And Its Purpose?

    Answer :

    Type libraries are files that explicitly describe some or all of the contents of components. This includes information about the methods properties constants and other members exposed by the component. Development tools such as Visual Basic make use of the information contained in the type library to help you as a developer access and use the component. In addition type libraries provide a convenient way to include a simple level of descriptive documentation for component members. You can use them through ‘Tools –> References’ in VBE.

  64. Question 39. What Is A Volatile Function?

    Answer :

    Volatile functions are a type of function that will always recalculate. That means whenever Excel needs to calculate any part of the worksheet, those cells containing volatile functions will also calculate.

  65. Question 40. How Do You Make A Udf Volatile?

    Answer :

    By adding Application.Volatile statement to it. It must be the first line of your User Defined Function.

  66. Excel Data Analysis Interview Questions

  67. Question 41. Is It Possible To Apply ‘application.volatile(false)’ To A Volatile Public Function Like Index And Make It Not Volatile?

    Answer :

    Actually INDEX is not a volatile function, even though some MicroSoft documentation says it is. Anyway no its not possible to apply Application.Volatile(False) to a built-in Excel function except by duplicating what the built-in function does inside a UDF.

  68. Question 42. What Is Excel Dependency Tree?

    Answer :

    • Dependency trees are excel way of minimizing the calculation by tracking what has changed since last calculation. It allows Excel to recalculate only:
    1. Formulae/Names that have changed.
    2. Formulae containing Volatile Functions.
    3. Formulae dependent on changed or volatile formulae or cells or names.
    • Excel determines dependencies by looking at the cells referred to by each formula and by the argument list of each function.
    • Dependency trees are immediately updated whenever a formula is entered or changed.
    • To force the dependency trees to be rebuilt and all formulae calculation use CTRL+ALT+SHIFT+F9.
  69. Excel pivot tables Interview Questions

  70. Question 43. How Do You Check The Calculation State ?

    Answer :

    using the Application.CalculationState property which tells if calculation has completed ( xlDone ), is pending ( xlPending) , or is in process ( xlCalculating ).

  71. Question 44. What Are Excel Dependency Tree Limits?

    Answer :

    There are two limits to the number of dependencies that Excel versions prior to Excel 2007 can track before it must do full calculations instead of recalculations.

    • The number of different areas in a sheet that may have dependencies is limited to 65,536.
    • The number of cells that may depend on a single area is limited to 8K.

    After the workbook has passed these limits, Excel no longer attempts to recalculate only changed cells. Instead, it recalculates all cells at each calculation.

  72. Question 45. What Do You Know About The Interpretation Features Of Vba?

    Answer :

    VBA is licensed to Microsoft and this compatible with and only Microsoft products. Code written is compiled by an intermediate language called P-code and this is stored in hosting applications such as Excel, Word and Access. The intermediate code is interpreted by a virtual machine. This code and intermediate language is the exclusive right of Microsoft.

  73. Question 46. What Is The Difference Between Usedrange And Currentregion Properties ?

    Answer :

    • The current region is a range bounded by any combination of blank rows and blank columns.
    • This property is useful for many operations that automatically expand the selection to include the entire current region, such as the AutoFormat method. This property cannot be used on a protected worksheet.
    • The UsedRange property is used to select the range of used cells on a worksheet. It returns a Range object that represents the used range on the specified worksheet.
    • Every non-blank cell got its CurrentRegion and its keyboard shortcut is Ctrl+Shift+Spacebar.
    • There can be many current regions but there is only one used range in a worksheet.
  74. Question 47. Which Are The 2 Macro Languages And Which Do You Use ?

    Answer :

    XLM (used in Excel 97 or before) and VBA(used for 2000 and after). Obviously, VBA is in use these days.

  75. Question 48. What Is View Port?

    Answer :

    The area under which the container provides the view of the ActiveX Document is known as a view port.

  76. Question 49. What Is The Size Of The Variant Data Type?

    Answer :

    The Variant data type has a numeric storage size of 16 bytes and can contain data up to the range of a Decimal, or a character storage size of 22 bytes (plus string length),and can store any character text.

  77. Question 50. What Are The Different Types Of Error?

    Answer :

    Syntax Errors, Runtime , Logic.

  78. Question 51. Can We Create Cgi Scripts In Vb?

    Answer :


  79. Question 52. What Are The Different Types Of Dialog Box?

    Answer :

    Predefined, Custom, User Defined.

  80. Question 53. What Are The Scopes Of The Class?

    Answer :

    Public, private, Friend.

  81. Question 54. What Is The Difference Between Property Get, Set And Let?

    Answer :

    Set Value is assigned to ActiveX Object from the form. Let Value is retried to ActiveX Object from the form. Get- Assigns the value of an expression to a variable or property.

  82. Question 55. What Are The Type Of Validation Available In Vb?

    Answer :

    Field, Form.

  83. Question 56. What Is Mapi ?

    Answer :

    Messaging Application programming Interface.

  84. Question 57. What Are The Style Properties Of List Box?

    Answer :

    Simple Single Select , Extended, Multiple Select.

  85. Question 58. What Is The Tool Used To Configure The Port Range And Protocols For Dcom Communications?

    Answer :


  86. Question 59. Which Controls Cannot Be Placed In Mdi?

    Answer :

    The Controls which do not have Align property can’t be placed on MDI Form.

  87. Question 60. What Is The Dll Required For Running The Vb?

    Answer :


  88. Question 61. Under The Ado Command Object, What Collection Is Responsible For Input To Stored Procedures?

    Answer :

    The Parameters collection.

  89. Question 62. What Are Some Benefits Of Using Mts?

    Answer :

    Database Pooling, Transactional operations, Deployment, Security, Remote Execution.