VBA For Excel Most Frequent Latest Interview Questions

VBA For Excel Most Frequent Latest Freshers Advanced Experienced Level Interview Questions and answers

Explain About Line Option Explicit?

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.

Give Technical Reasons Which Made Microsoft Withdraw Its Support For Vba In Mac?

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.

How Can You Format Expressions By Using Vba?

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.

How Do You Use The Getsetting And Savesetting Functions To Read And Write Registry Settings?

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.

What Forms Should Be Used For Complex User Input?

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.

Explain About Visual Basic And Its Importance?

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.
VBA For Excel Most Frequent Latest Interview Questions
VBA For Excel Most Frequent Latest Interview Questions

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

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.

Name The Platforms Through Which Visual Basic Applications Are Available?

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.

Define And Explain About Com Add-ins?

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.

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

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.

Explain About The Security Vulnerabilities For Vba?

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.

Explain About Function Pointers?

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.

State Some General Uses For Visual Basic Applications In General Context?

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.

Difference Between Activeworkbook And Thisworkbook.

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.

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

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.

Difference Between Activex And Form Controls.

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.

What Is The Difference B/w Functions And Subroutines?

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.

How To Debug A Vba Code?

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

Explain About Insert Module And Goal Seek Functions Present In Vba?

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.

How Can We Use Data Validation Function In Vba?

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.

How Can We Dial A Phone Number?

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.

What Is The Difference Between Byval And Byref And Which Is Default ?

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.

What Is The Meaning Of Option Explicit And Option Base?

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.

What Are Various Data Type And Their Size?

 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.

Draw Basic Excel Object Model?

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

Can You Lock Cells Such That Only Specific Users Can Modify Them?

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

Which Controls Cannot Be Placed In Mdi?

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

What Is The Dll Required For Running The Vb?

Vbrun300.dll.

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

The Parameters collection.

What Are Some Benefits Of Using Mts?



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

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

Using 'Data Validation'.

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?

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

What Is Ado, Oledb & Odbc?

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).

How To Set The Custom Paper Size In Excel Object Through Vb?

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

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

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.

Does Vba Supports Oop Principles?

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.

To Set The Command Button For Esc, Which Property Needs To Be Changed?

Set Cancel property of Button to True on the Form.

What Is Type Library And Its Purpose?

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.

How Can You Increase The Number Of Rows In A Worksheet?

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.

How Can You Increase The Number Of Columns In A Worksheet?

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.

How Will You Distribute A Workbook Such That It Can't Be Copied Using Macro Or Anything?

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)

What Types Of Workbook Protection Are Available?

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.

What Is A Volatile Function?

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.

How Do You Make A Udf Volatile?

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

Is It Possible To Apply 'application.volatile(false)' To A Volatile Public Function Like Index And Make It Not Volatile?

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.

Which Are The 2 Macro Languages And Which Do You Use ?

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

What Is View Port?

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

What Is The Size Of The Variant Data Type?

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.

What Are The Different Types Of Error?

Syntax Errors, Runtime , Logic.

Can We Create Cgi Scripts In Vb?

Yes.

What Are The Different Types Of Dialog Box?

Predefined, Custom, User Defined.

What Is Excel Dependency Tree?

Dependency trees are excel way of minimizing the calculation by tracking what has changed since last calculation. It allows Excel to recalculate only
Formulae/Names that have changed.
Formulae containing Volatile Functions.
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.

How Do You Check The Calculation State ?

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

What Are Excel Dependency Tree Limits?

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.

What Do You Know About The Interpretation Features Of Vba?

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.

What Is The Difference Between Usedrange And Currentregion Properties ?

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.

What Are The Scopes Of The Class?

Public, private, Friend.

What Is The Difference Between Property Get, Set And Let?

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.

What Are The Type Of Validation Available In Vb?

Field, Form.

What Is Mapi ?

Messaging Application programming Interface.

What Are The Style Properties Of List Box?

Simple Single Select , Extended, Multiple Select.

What Is The Tool Used To Configure The Port Range And Protocols For Dcom Communications?

DCOMCONFIG.EXE.

Post a Comment

Previous Post Next Post